Tagged: related posts
-
AuthorPosts
-
February 26, 2019 at 3:47 am #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.
March 2, 2019 at 7:45 pm #1073710Hey RobWestbrook,
Sorry for the late reply,
This is no longer available.Best regards,
MikeMarch 2, 2019 at 11:09 pm #1073773Hi Mike,
Thanks for the info but I got the related posts working by adding this shortcode in a code block:
[avs_related_entries]
March 2, 2019 at 11:49 pm #1073783Hi,
Thanks for sharing your solution. Unless there is anything else we can assist with on this issue, shall we close this then?Best regards,
MikeMarch 3, 2019 at 3:41 am #1073802Sure. 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.
March 3, 2019 at 7:01 pm #1073999Hi,
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,
MikeJuly 3, 2019 at 8:24 am #1115370hi 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
July 4, 2019 at 10:46 am #1115699Hi,
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,
IsmaelJuly 6, 2019 at 1:45 am #1116125so 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 ?July 6, 2019 at 3:52 am #1116135Hi,
@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,
MikeJuly 9, 2019 at 1:16 pm #1117042thanks, but I still don’t understand what to do exactly with these files:
https://github.com/mgmason/enfold-related-posts-elementDownloading 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.July 9, 2019 at 2:02 pm #1117059Hi,
@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,
MikeJuly 9, 2019 at 4:55 pm #1117097yes, 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)
b) nothing appears in the frontend
July 9, 2019 at 11:11 pm #1117221Hi,
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,
MikeDecember 18, 2022 at 11:03 am #1376557Got 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.
December 18, 2022 at 4:20 pm #1376599Hi,
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 -
AuthorPosts
- The topic ‘Enable Related Posts’ is closed to new replies.