[Support request] Change place of post title and keep menu collapsed

Home Forums Support [Support request] Change place of post title and keep menu collapsed

Home Forums Support Change place of post title and keep menu collapsed

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1515597
    Gabriela

    Hi there,
    Two questions:
    1. I am trying to place the gallery post title so that it displays below the gallery (I have marked it with {{post_title}} here: https://danielaschneider.com.br/portfolio/artur-alvim/ ). So I created a Layout Element for that type of post disabling the Post title. And I think I can enable it where I want with a Hook Element. Am I right? What arguments shall I put in that hook?

    2. I want the Menu to remain collapsed when I open the Portfolio page (it’s empty for now).

    Thank you!

    #1515925
    David
    Staff
    Customer Support

    Hi there,

    there are no Hooks within the Post/Page Content, as you have added the gallery to the page content you would have to also add your own H1 title to the content.

    #1516941
    Gabriela

    Hi,
    But the title is given by the album itself (the plugin creates the post with the album inside). My client won’t have access to a post to edit it. I need to facilitate to my client. I should create a template to have that result? Hooks can’t handle the post title?

    #1517003
    Elvin
    Staff
    Customer Support

    Hi,

    Since, there’s no hooks to place your post title within the content we can do a workaround by making a shortcode we can place within the content to serve as our dynamic “hook”.

    You can make a shortcode that lets you display your post title anywhere you want.

    Here’s an example:

    add_shortcode( 'post_title', function() {
        ob_start();
        // Start your PHP below
      
        echo '<h1 class="sh-post-title">'.get_the_title().'</h1>';
      
        // End your PHP above
        return ob_get_clean();
    } );

    You can then display your page/post title by using the shortcode [post_title] anywhere within the content.

    #1517052
    Gabriela

    Perfect!

    Thank you!

    #1517105
    Elvin
    Staff
    Customer Support

    Nice one.

    No problem. 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.