Tagged: 

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1071604

    I’ve searched the entire forum and tried everything I’ve found. I still can’t get related posts to work.

    Can someone explain — step-by-step — how to get related posts working.

    I have 10 posts, at least, with the same tags.
    I have enabled them in the Enfold setup.
    Nothing.

    I’ve added the blog block in ALB. It just shows the latest posts, including the post it’s currently on.

    I’ve added php code directly to the single.php file.

    I’ve created my own related-posts.php file in my child theme includes folder.

    Again, nothing.

    I’m using a Related Posts Plugin but I really want this to work natively.

    If anyone can help I would really appreciate it.

    #1073710

    Hey RobWestbrook,
    Sorry for the late reply,
    This is no longer available.

    Best regards,
    Mike

    #1073773

    Hi Mike,

    Thanks for the info but I got the related posts working by adding this shortcode in a code block:
    [avs_related_entries]

    #1073783

    Hi,
    Thanks for sharing your solution. Unless there is anything else we can assist with on this issue, shall we close this then?

    Best regards,
    Mike

    #1073802

    Sure. And please share the plugin and shortcode somewhere in the documentation. That would have saved me hours searching the forums without any success. I eventually found the shortcode digging through the theme’s code myself. Easy fixes are much better addressed in the documentation than having your paying customers search for forum answers on their own.

    #1073999

    Hi,
    Sorry for the trouble, but your shortcode doesn’t work for me. I thought the plugin was linked in the documentation, I’ll have to take another look.

    Best regards,
    Mike

    #1115370

    hi mike can you describe where i have to place the files
    related_posts.php goes to : ( i tried child-themes/shortcodes )
    enfold-related-posts-element goes to ( i tried plugins folder ) but activation of plugin leads to fatal error.

    the GitHub is a little underdocumented

    #1115699

    Hi,

    According to the enfold-related-posts-element.php > avia_include_shortcode_template function, the shortcode file should remain inside the shortcodes folder of the plugin directory. Do you see any errors after activation? I will tag @Mike to the thread.

    Best regards,
    Ismael

    #1116125

    so for that i had to create a plugin/shortcodes folder ?
    Wouldn’t it be better to work with the mostly already existing one in child-themes/shortcodes folder ?

    #1116135

    Hi,

    @Guenni007
    Thank you, I will need to add more documentation. This is a plugin, my thought was that this would be easier for people. But good point I will add a “child-themes/shortcodes” folder version.

    Best regards,
    Mike

    #1117042

    @mike

    thanks, but I still don’t understand what to do exactly with these files:
    https://github.com/mgmason/enfold-related-posts-element

    Downloading the ZIP and adding it to WordPress’ plugin folder causes a fatal error:

    Fatal error: Cannot redeclare avia_include_shortcode_template() : eval()'d code:3) in ../wp-content/plugins/enfold-related-posts-element-master/enfold-related-posts-element.php on line 57
    (newest WP, newest ENFOLD)

    I’m not a coder, so could you please explain what to do with it?
    Thank you.

    #1117059

    Hi,
    @Gitte I tested the plugin again on a clean install and it seems to be working correctly for me. You would just install the plugin as any other plugin and then the element will be usable in the Advanced Layout Builder.
    As for your error, line 57 is for “$paths, $template_url.’/shortcodes/'”
    So I assume that you are using a child theme and have already declared this path for custom shortcodes.
    In your case, if you already have the “shortcodes” path created, you could remove the plugin and copy the enfold-related-posts-element/shortcodes/related_posts.php to your /shortcodes/ folder and see if that works.

    I would be happy to take a look at what’s going on but I will need an admin & ftp login.
    After I created this plugin I found a “shortcode” that can be added to a code block element without the plugin, if you would like to try this, then deactivate the plugin and add this to your functions.php:

    function related_posts_shortcode( $attr ) {
        ob_start();
        get_template_part( 'includes/related-posts' );
        return ob_get_clean();
    }
    add_shortcode( 'rpost', 'related_posts_shortcode' );

    then in your code block element use this shortcode:

    [rpost]

    Best regards,
    Mike

    #1117097

    yes, indeed, I have a snippet for the Spiderfly ALB elements from @kahil, that goes to the “shortcodes” folder.

    I put the related_posts.php now in this “shortcodes” folder, so far, so good.
    It appears as an ALB element, that I put at the bottom of a post.

    But:

    a) there are no settings possible? When clicking on it nothing happens? (Firefox, Windows 10)

    View post on imgur.com

    b) nothing appears in the frontend

    #1117221

    Hi,
    Yes, there are no settings, but you have to be sure to use some tags, because the related posts are picked by tags.
    Perhaps this is why nothing appears on the frontend?

    Best regards,
    Mike

    #1376557

    Got the same problem (Blog posts, created with ALB).
    Unfortunately, the plugin link from above doesn’t work anymore..

    Can you pls. let me know the actual link for the “Enfold Related Posts Element” plugin?

    Thx in advance,
    Jürgen

    • This reply was modified 2 years ago by JVo.
    #1376599

    Hi,
    Thanks for your question, there was no official plugin for adding the Related Posts Element to Advanced Layout Builder pages, it was something I created years ago that didn’t work correctly.
    You can use this function if you wish, I have tested it and it is working in 2022
    Add this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function related_posts_shortcode( $attr ) {
        ob_start();
        get_template_part( 'includes/related-posts' );
        return ob_get_clean();
    }
    add_shortcode( 'rpost', 'related_posts_shortcode' );

    then in a code block element use this shortcode: [rpost]
    For the element to work you must add tags to your post that other posts also use, this is how the element picks which posts to show.

    Best regards,
    Mike

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Enable Related Posts’ is closed to new replies.