Multiple content areas per page

This sounds to me like a perfect use of Advanced Custom Fields “flexible content” feature to me. Flexible content fields allow you to define multiple layouts, and then add them to a page or post one by one, in any order or combination you need. Each layout can be a combination of text fields, images, … Read more

Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)

Why it is added in the footer: This is the expected behaviour. Since you have enqueued the style within your Shortcode hook function, by the time it executes, WordPress is already done generating the <head> section of your page, since WordPress will only execute your shortcode function once it has found the shortcode in your … Read more

shortcode for logo image

Change ‘name’ => ”, to ‘name’ => ‘logo’, Then when there is no name field passed to the shortcode, it will default to logo, which will load logo.png.

Loading shortcode with ajax

You cannot load a file directly like this: $(‘.homepage__slider’).load(‘wp-content/themes/mytheme/slider.php’); Also note that WordPress loads jQuery in noConflict mode, so the $ alias does not work. If you load a file directly none of the WordPress functions will work. You should be using the AJAX API so that everything loads in WordPress context. You would wrap … Read more

do_shortcode inside AJAX callback

The How It would be much better and easier if you’d just add the script directly to the main body instead of the AJAX call. The same goes with the shortcode result. Just use the shortcode as argument inside wp_localize_script(): wp_localize_script( ‘script-handle’, ‘pluginObject’, array( ‘contactForm’ => do_shortcode( ‘[contact-form-7 id=”698″ title=”Meet The Team Email”]’ ), ) … Read more

How to parse nested shortcodes?

There’s a solution for that, actually. The shortcode you are using has the variable $content, whithout the filter do_shortcode, like this: do_shortcode($content) Open the file where there are the shortcodes and change $content for do_shortcode($content). It will work.

how do you get the author’s username?

In the Loop, it would be: $authorname = get_the_author_meta(‘user_nicename’); Or: $authorname = get_the_author_meta(‘displayname’); Or: $authorname = get_the_author_meta(‘nickname’); Or any field that get_the_author_meta() accepts. $authorname = get_the_author_meta(‘user_nicename’,123); If you just need to echo the name just use the_author_meta() instead: the_author_meta(‘user_nicename’,123);

How to add attribute to output with wp_video_shortcode add_filter

I get Undefined variable: for $video, $post_id and $library and the video’s in the page are blank. Replace: add_filter( ‘wp_video_shortcode’, ‘my_video_shortcode’, 10, 2 ); with: add_filter( ‘wp_video_shortcode’, ‘my_video_shortcode’, 10, 5 ); to access all five input arguments in your filter’s callback. ps: my_ is such a common prefix, that I would consider something more unique. … Read more

How can I just get content inside a shortcode or just outside

Depends on the shortcode. If you have access to the shortcode’s handler function, that function’s second argument is the content inside the shortcode: function wpse20136_shortcode( $atts, $content ){ // $content has the content inside xxx } register_shortcode( ‘xxx’, ‘wpse20136_shortcode’ ); For getting all content not in shortcodes, that’s easy. strip_shortcodes() does that: strip_shortcodes( get_the_content() ); … Read more

Run shortcode before filters

You can filter the array $no_texturize_shortcodes, which is a collection of shortcodes that are excluded from wptexturize. If you do this, everything within [codigo] shortcode tags will not be texturized: add_filter( ‘no_texturize_shortcodes’, ‘no_texturize_codigo_shortcode’ ); function no_texturize_codigo_shortcode( $excluded_shortcodes ) { $excluded_shortcodes[] = ‘codigo’; return $excluded_shortcodes; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)