• Hi everyone, hoping you can help me. I managed to set up a featured block with get_the_content() on the index page but when I go to the page and try to edit, it wants to edit the featured content post I put in the block, not the page itself. I would like to just have the part of the post that is content, not everything. I’m using a way to switch out the content, rotating it based on the category tag updating the publish date. I think it’s messing up my css as well because when I go to minify the css, it completely messes it up. If I’m not being clear about what I need, I’ll try to elaborate some more.

Viewing 1 replies (of 1 total)
  • What you need is an edit post link!

    You can use <a href="https://developer.ww.wp.xz.cn/reference/functions/get_edit_post_link/">get_edit_post_link()</a>

    get_edit_post_link ( int $id, string $context = 'display' )

    On my WordPress themes I always link to have an edit link at the top of the posts by the title so that if I spot a mistake with the post I can easily edit it quickly.

    Here is a WordPress snippet to use which will add an Edit this link at the top of your page. It will only be visible to the admin user and will take them directly to the edit post page.

    This uses the WordPress function edit_post_link(), it must be used inside the_loop.

    Just place the following in your theme where you want the edit link to appear.

    <?php edit_post_link(__('Edit This')); ?>

    edit_post_link Function
    This function takes a maximum of 4 parameters.

    <?php edit_post_link( $link, $before, $after, $id ); ?>

    Link – The link text. Default is set to Edit This.
    Before – The text which is added before the link text.
    After – The text added after the link text.
    Id – The Post id to link to.

Viewing 1 replies (of 1 total)

The topic ‘get_the_content() without head section’ is closed to new replies.