• Resolved kyool

    (@kyool)


    Is there any way to call the function directly in the single.php, instead of using the content filter?

    I would rather this info not show up as part of the actual content of the post, but afterwards. I am doing some pagination printing and printing of share links in the single.php and want the related posts to appear after all of that. Also, I have noticed for really short posts, this related posts info gets put into the excerpt.

    http://wordpress.org/extend/plugins/spostarbust/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Eli

    (@scheeeli)

    I understand you need. Here is what I would suggest you try:

    <?php
    $SPOSTARBUST_widget = true;
    SPOSTARBUST_init();
    unset($_eli_debug_microtime['SPOSTARBUST_init_skip']);
    echo SPOSTARBUST_related_links_on_posts("");
    ?>

    Be sure to try this with “Automatically add links to Related Posts at the bottom of every Post?” turned off in the settings.

    Please let me know how this works for you.

    Aloha, Eli

    Thread Starter kyool

    (@kyool)

    Hmm, I checked the No option and saved the settings and then tried the following:

    if( function_exists(‘SPOSTARBUST_related_links_on_posts’)) {
    $SPOSTARBUST_widget = true;
    SPOSTARBUST_init();
    unset($_eli_debug_microtime[‘SPOSTARBUST_init_skip’]);
    echo SPOSTARBUST_related_links_on_posts(“\n \n”);
    }

    but I was seeing it twice now–once in the content and once afterwards.

    So I edited the code and //’d out the two add_filter calls and it looks like it’s working correctly now.

    Thanks.

    Plugin Author Eli

    (@scheeeli)

    Thanks for the update. I’ll mark this topic resolved for now. Your’s is the 2nd request for theme integration so I am thinking of adding a quick-and-easy drop-in-your-theme function in a future release. Please let me know if you find anything else that may help.

    Aloha, Eli

    Thread Starter kyool

    (@kyool)

    I spoke too soon–looks like this causes the post to displayed twice–it starts all over again after the Recent Posts box.

    Plugin Author Eli

    (@scheeeli)

    So the Recent Post box is resetting the page query or something?

    Can you send me a link to the misbehaving page so I can check it out?

    Thread Starter kyool

    (@kyool)

    OK, so here’s the latest, which seems to work:

    I left the settings set to

    yes (Use this setting and you don’t need the Widget)

    In my single.php I added:

    <?php
    if( function_exists('SPOSTARBUST_related_links_on_posts')) {
        $SPOSTARBUST_widget = true;
        SPOSTARBUST_init();
        unset($_eli_debug_microtime['SPOSTARBUST_init_skip']);
        echo SPOSTARBUST_related_links_on_posts("\n \n");
    }
    ?>

    And in the index.php for the plugin, I commented out lines 318 and 610, which did:
    /add_filter('the_content', $SPOSTARBUST_plugin_dir.'_related_links_on_posts');

    Plugin Author Eli

    (@scheeeli)

    Cool kyool,
    Thanks for the update. I’ll test that method out in a new function wrapper and use it on one or two of my custom Themes. If it works good for me then I’ll put it in my next release.

    Aloha, Eli

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to call function directly in single.php, without using filter?’ is closed to new replies.