• Resolved dieter93

    (@dieter93)


    Hi, nice plugin! exactly what I’m looking for ??

    is it possible to output the widget title also via PHP?

    I use an element that I have on certain pages. This works with PHP but the “Title to show above the related posts” is not displayed.

    Thanks for an answer.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Marcel Pol

    (@mpol)

    Hi,

    Not directly, no. You would have to program a class that extends the widget I think.

    But I don’t understand the problem you have. There might be a better solution.
    Can you share the link to your website and state the problem?

    Thread Starter dieter93

    (@dieter93)

    I am currently working on a password protected staging environment.
    Perhaps I have not expressed myself clearly enough.

    My problem is the following:

    I would like to have the Realted Posts at the end of my posts. However, I am using another plugin that inserts social sharing buttons also at the end of the post.
    Now it is so that your plugin inserts the related posts directly after post end and the social sharing buttons come afterwards. But I want the related posts to be at the very end.

    With a Generatepress element, I can place the related post PHP code the way I like it. However, this does not display the title that I can enter in the settings.

    That’s why I asked if the title can also be output with PHP.

    For better understanding here is a screenshot:
    Screenshot

    Plugin Author Marcel Pol

    (@mpol)

    If you are putting it in the template file, you could simply have:

    <?php echo '<h3>Related Posts</h3>'; ?>

    I assume it is more complex then?
    The whole block for the content filter should start with this:
    <div class="related_content" style="clear:both;">
    When you look in the inspector, what do you see? Is there something as an overlay?

    You can check the inspector by hitting F12, or by right-clicking and selecting “Inspect Element’, then select the Console-tab.

    It does make giving support a bit harder, not being able to see it myself ??

    Thread Starter dieter93

    (@dieter93)

    Yes, it is more complex. Because if I insert a simple output, this output is also displayed on posts that have no Realted Posts added.

    If I insert it automatically, the title will be displayed only if Related Posts have been added as well.

    The following PHP code I used:
    <?php global $related; echo $related->show( get_the_ID() ); ?>

    and it only inserts me the following:

    Screenshot

    There is no overlay or something.
    Only the

      list is inserted, without <div> and <h3> title.

      I don’t want to open my test environment and I don’t want to post a password here.
      I could email you if you want to check?

    • This reply was modified 1 year, 11 months ago by dieter93.
    Plugin Author Marcel Pol

    (@mpol)

    Does this work for you then?

    <?php
    global $related;
    $related_posts = $related->show( get_the_ID() );
    if ( $related_posts ) {
        echo '<h3>Related Posts</h3>';
        echo $related_posts;
    }
    ?>
    Plugin Author Marcel Pol

    (@mpol)

    I just borrowed it from the content filter. You could borrow more if you need or want.
    https://plugins.trac.www.ads-software.com/browser/related/tags/3.2.0/related.php#L413

    Thread Starter dieter93

    (@dieter93)

    This works – thank you very much for that!
    I can work with it ??

    Really a good plugin and thanks for your good and fast support.

    A good review will follow.

    Thank you very much.

    How can I send you a coffee? ??

    Plugin Author Marcel Pol

    (@mpol)

    You’re welcome ??

    You could donate a bit through paypal if you want and have that. My email there is [email protected]

    By bank is possible too, contact me then on that email address.

    Thread Starter dieter93

    (@dieter93)

    Coffee is on the way ??
    Thanks again

    Plugin Author Marcel Pol

    (@mpol)

    Thank you too ??

    Have a good weekend already.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Widget Title output with PHP?’ is closed to new replies.