• Resolved raskull

    (@raskull)


    Hi, it’s me again. I see your code for filtering the wrapper opening and close. However I need to get the category variable into the opening. What is the best way to accomplish what I want without hacking your plugin?

    Below is my hack to your line 149, the results of which provide a link to the category page of the category that was specified in the shortcode [display-posts category="Foo" posts_per_page="3"] and looks like this: Foo Headlines : More Foo

    $open = apply_filters( 'display_posts_shortcode_wrapper_open', '<h2>' . $category . ' Headlines : <a href="' . get_category_link( get_cat_ID( $category ) ) . '">More ' . $category . '</a></h2><' . $wrapper . ' class="display-posts-listing">' );

    http://ww.wp.xz.cn/extend/plugins/display-posts-shortcode/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    Hmm, I don’t think that can be done with the filter as it is. All the filter lets you do is modify it as straight text – it doesn’t pass any of the shortcode’s parameters for you to work with (like category).

    I’d need to modify the filter to pass the $atts, and then you could then pull the category out of that.

    Thread Starter raskull

    (@raskull)

    Well, I’ll leave it up to you whether you think that would be useful to others and worth your effort.

    p.s. I do appreciate your super clean work, which even I, a novice, can recognize!

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

The topic ‘[Plugin: Display Posts Shortcode] use $category in opener without hacking plugin?’ is closed to new replies.