Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Brecht

    (@brechtvds)

    What is it you’re trying to achieve exactly?
    It’s possible to execute shortcodes in PHP by doing something like:

    <?php echo do_shortcode( '[custom-related-posts]' ); ?>

    Does that help for what you want to do?

    Thread Starter rafael666

    (@rafael666)

    Hello !

    Thanks for the quick answer (and apologize for my poor english) !

    I want try to make a condition. If 0 Related Posts, don’t show anything (actually, the shortcode display always “Related Posts” “None found” if any related posts).

    I tried to find the good portion of code (the php translation of shortcode) but, arghhhh, I haven’t found…

    Have a nice day !
    RaF

    Plugin Author Brecht

    (@brechtvds)

    There are actually a few parameters you can add to the shortcode. One of those is the text to show when there are no related posts shown. Try this one:

    [custom-related-posts none_text=""]

    Thread Starter rafael666

    (@rafael666)

    Yes but no 🙂 I want to hide all the block (“Related Posts” too).

    This parameter is just for change the text. I search a solution with Manuel Related Posts (in admin, your plugin is what i search) but with more flexibility for the display and integration in php templates files (hide the complete block if any related post…)…

    Thanks for this exchange !
    Have a nice day !
    RaF

    Plugin Author Brecht

    (@brechtvds)

    If you use [custom-related-posts none_text=””] it should not show anything at all, actually.

    Thread Starter rafael666

    (@rafael666)

    In this case, “none found” is not displaying but the title RELATED POST is showing !

    RaF

    Plugin Author Brecht

    (@brechtvds)

    What’s the exact shortcode you’re using? I tested it again, just to be sure, and when I use this nothing shows up when there are no related posts:
    [custom-related-posts title="Related Posts" order_by="title" order="ASC" none_text=""]

    You are using version 1.2, right?

    Thread Starter rafael666

    (@rafael666)

    My apologies !
    This morning, I reinstalled your plug-in, re-activate him, made another try and the block and title Related Post isn’t display anymore when there are no related posts. I don’t know why yesterday the display of the title was always visible !

    Very easy to custom with CSS, it’s very great !
    Thank you so much for your patience !
    rafael

    Plugin Author Brecht

    (@brechtvds)

    Good to hear it’s working now!
    Just let me know if you have any other questions or suggestions.

    Brecht

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

The topic ‘PHP Issue’ is closed to new replies.