-
AuthorPosts
-
April 8, 2019 at 3:49 pm #1088351
Hi,
I used this method to add a “edit this page” link to every page I created with ALB from @nikko
https://kriesi.at/support/topic/how-to-add-edit-link-for-pages-posts-in-the-functions-php/#post-911525It worked fine in the past but since the latest ENFOLD this link does not appear any more.
Could you please verify at your own installation of ENFOLD, if adding this function from @nikko (see link above) to ENFOLD still shows the EDIT link on pages made with ALB (I put this code snippet to my code-snippets plugin)?
add_filter('the_content', 'mycontent'); add_filter('avf_template_builder_content', 'mycontent'); function mycontent( $content ) { if( is_singular() ) { $class = 'page-edit'; if (strpos($content, $class) == false) { $content = $content . '<p class="page-edit"><a href="' . get_edit_post_link( get_the_ID(), 'Edit this page') . '">Edit this page</a></p>'; } } return $content; }
Thank you.
April 11, 2019 at 5:45 pm #1089641Hey Gitte,
I have asked Nikko to check this out for you :)
Best regards,
BasilisApril 11, 2019 at 5:56 pm #1089651Thanks.
April 11, 2019 at 7:31 pm #1089693Hi Gitte,
I just tested it on my local site using Enfold 4.5.5 and it still works.
Try clearing out cache, maybe that’s causing the issue.Best regards,
NikkoApril 12, 2019 at 2:02 pm #1090063Hi @nikko
that is very strange, on some ALB created pages I see the red “edit this page” link and on other pages not.
What I discovered, when I use the custom menu widget on a with ALB created page, and I look into the source code of the page, there is a strange</p>
and I cannot see where it is coming from, it seems that it has something to do with the custom menu widget:
This p-tag is only visible if you look at the frontend source code of the browser (Firefox in my case), but if I try to check this with Firefox developer tools, I cannot find this p-tag.
See private data please @nikko
April 15, 2019 at 7:20 am #1090859Hi Gitte,
I also could not figure out what’s causing that extra closing p tag, but I can confirm that it’s not the widget area since I tested another widget area with an archive widget and it does not add the extra closing p tag.
As for Edit this page not showing, it’s because of 2 reasons, one is the last element or layout element is hidden on desktop and the 2nd one if it’s visible on desktop it’s misplaced because of the floated elements above it.
To fix the 2nd reason, please add this css code also to make sure the Edit this page text is in the proper position:#top .page-edit { clear: both; }
Best regards,
NikkoJune 2, 2019 at 8:54 pm #1106431Thanks, I still cannot get this code snippet function to work on ALB created pages.
Now I will try it to add a edit-link snippet directly in the theme file.
I remember, that in former ENFOLD versions it was the template-builder.php file, but in the latest version this file is rather empty.
So could you please tell me what code snippet exactly I need to add to what theme file to show an EDIT link in pages created with the ALB?
Thank you.
June 3, 2019 at 5:31 am #1106566Hi Gitte,
I still have the code you posted above on my end and it still works on my end, the problem I’ve seen on your site is if the last section is only visible on mobile the Edit link would also show up just on mobile since the container it’s in is also in hidden in desktop and shown in mobile. To workaround I found is to create an empty container as the last element which is visible on both desktop and mobile.
Best regards,
NikkoJune 3, 2019 at 2:49 pm #1106713ah okay, I understand, thanks.
Or would be an option to add the EDIT link not at the end of the content but at the beginning of the content?
How can I modify the code for this please?add_filter(‘the_content’, ‘mycontent’);
add_filter(‘avf_template_builder_content’, ‘mycontent’);function mycontent( $content ) { if( is_singular() ) { $class = 'page-edit'; if (strpos($content, $class) == false) { $content = $content . '<p class="page-edit"><a href="' . get_edit_post_link( get_the_ID(), 'Edit this page') . '">Edit this page</a></p>'; } } return $content; }
Thank you.
June 4, 2019 at 12:16 pm #1107045Hi,
Thank you for the update.
You should reverse the $content and the “page-edit” markup in the following line if you want to move the link before the content.
$content = $content . '<p class="page-edit"><a href="' . get_edit_post_link( get_the_ID(), 'Edit this page') . '">Edit this page</a></p>';
.. should be:
$content = '<p class="page-edit"><a href="' . get_edit_post_link( get_the_ID(), 'Edit this page') . '">Edit this page</a></p>' . $content;
Best regards,
IsmaelJune 4, 2019 at 1:52 pm #1107091That works fine, thank you very much!
June 4, 2019 at 6:39 pm #1107221Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘EDIT link for ALB pages?’ is closed to new replies.