Tag Info

New answers tagged

3

Here's just an addition to the answer by @PieterGoosen. There are few methods how one could modify the post type of WP_Query, that's inside a shortcode. Let's assume it's [recent_posts]. Method A) If the shortcode uses the third parameter of the shortcode_atts() (as @PieterGoosen mentioned) for example wpse, then: /** * Method A: Using the ...


4

Without seeing your code it is difficult to give you an exact answer. There is the shortcode_atts_{$shortcode} filter that was introduced in Wordpress 3.6. All attributes is run through this filter. It has to be noted that the $shortcode parameter needs to be set in shortcode_atts. I haven't seen shortcodes yet that has this parameter set though. Your ...


2

Untested (and can't test right now) but you ought to be able to add attributes with a filter... something like: function test_sc($atts,$content) { // echo 'test_sc'; $atts = shortcode_atts( array( 'foo' => 'no foo', 'bar' => 'default bar', ), $atts, 'testsc' ); // var_dump($atts); } ...



Top 50 recent answers are included