Tagged: , , ,

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #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-911525

    It 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.

    #1089641

    Hey Gitte,

    I have asked Nikko to check this out for you :)

    Best regards,
    Basilis

    #1089651

    Thanks.

    #1089693

    Hi 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,
    Nikko

    #1090063

    Hi @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:

    View post on imgur.com

    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

    #1090859

    Hi 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,
    Nikko

    #1106431

    Thanks, 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.

    #1106566

    Hi 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,
    Nikko

    #1106713

    ah 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.

    #1107045

    Hi,

    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,
    Ismael

    #1107091

    That works fine, thank you very much!

    #1107221

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘EDIT link for ALB pages?’ is closed to new replies.