Support » Plugin: WP Page Widget » Shortcode breaks Plugin

  • Resolved Gerdski


    Hi there,

    the Plugin works great an all my pages, except for the pages where I added a simple function via shortcode. The widgets just don’t show up. If I change the shortcode (“_get_special_posts”) the Widgets do appear.

    The shortcode is this:

    [get_special_posts cat=1 anz=3]

    and in functions.php I have this:

    function get_special_posts_function($atts) {
    	$a = shortcode_atts( array(
            'cat' => '1',
            'anz' => 5
        ), $atts );
    	echo $header;
                    if (have_posts()) : while (have_posts()) :
                     $t = get_the_title();
                     echo "<h3>".$t."<h3>";
    add_shortcode( 'get_special_posts', 'get_special_posts_function' );  

    What is wrong here? How can I fix this?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Gerdski


    I should add that WP and the Plugin are installed with the latest versions, and the Template is TwentySixteen.



    OK, I solved it. It was my fault.

    “query_posts” was not the best way to get the posts in my function, because it interfered with The Loop.

    Now I use “get_posts” instead, the content is returned in a different way (have to use nl2br), but it all works fine now.

    Resolved 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode breaks Plugin’ is closed to new replies.