Home Forums Support Hook

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #1071773
    An Nguyen

    Hi all,

    May I ask you a question with custom hook?

    I want to make a hook to insert number of comment shortcode after title in blog page (inside anchor tag of title) like markup below in GP 2.4 version.

    <a class=“title”> The important of SEO [insert SHortcode here] </a>

    I tried with after-archived-title but it is below anchor tag.

    <a class=“title”> The important of SEO </a>
    [insert SHortcode here] 

    I like it next to text-title.
    I’ve just updated to new official version and Iam not sure if we have a new hook to do that.

    Thanks in advance.

    GeneratePress 2.4
    GP Premium 1.9

    Lead Developer
    Lead Developer

    As of right now it’s not possible to hook anything into the title like that – WordPress itself makes it very difficult.

    To do this, you would need to remove the default content title, and then hook in your own content title along with the shortcode.

    I mentioned the same thing here: https://generatepress.com/forums/topic/support-on-summary-and-entry-title/#post-1042934

    You can remove the default title by creating a Layout Element and using Disable Elements to disable the content title.

    Then you can add your own title code by using the_title() in a Hook Element: https://developer.wordpress.org/reference/functions/the_title/

    An Nguyen

    Hi Tom,

    Thanks for feedback! I knew this method because you’re already mentioned in my previous post.

    But I dont want to change the current layout for just a light customised stuff.

    Can you help me with CSS instead?

    I want like number of comment and its icon display at the end of Text-title Ex: “TOGAF – Enterprise Architecture Framework icon+3 ”

    Now current markup is:

    <header class="entry-header">
    			<h2 class="entry-title" ><a>TOGAF – Enterprise Architecture Framework</a></h2>
          <span class="text-number"> <i class="fa fa-comment"></i> 3 </span>			
    Customer Support

    Hi there,

    the Post titles are variable in length and may span across more then one line, which makes it impossible to put the shortcode inline with the title using CSS.

    The method Tom suggested is the only way to do this.

    An Nguyen

    Hi David,

    Finally, I can find the solution for my case. We can wrap number-comment with p tag and use flex-box to solve the problem and it works like a charm without editing template.

    Thanks David & Tom.

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