• Resolved redmercer

    (@redmercer)


    Would it be possible to add content below the title on each page?

    I went through and added the hero widget on page headers but I’d like for the content to be different for each page.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter redmercer

    (@redmercer)

    Ok I managed to figure it out. Posting below what I ended up doing.
    Side note: It would be great to be able to update the copy outside of the functions.php file. Suggestion on how to accomplish that would be awesome.

    funtcions.php

    add_action( 'my_own_action',       'my_own_action_function',10 );
    function my_own_action_function(){
    	echo "<h3>hello world</h3>";
    }

    page-title.php

    	do_action( 'primer_before_page_title' );
    
    		primer_the_page_title();
    		do_action('my_own_action');
    

    The what the file plugin was very helpful in figuring out what file to look for.

    Perfect @redmercer,

    That is a great approach. Although I would caution you that future updates will remove that custom action you’ve set in place.

    Why not just hook into primer_after_page_title just below do_action('my_own_action');?

    https://github.com/godaddy/wp-primer-theme/blob/ab04b6c6fc3b92b7e076535083c6af01e13a6189/templates/parts/page-title.php#L26-L31

    Hooking into primer_after_page_title with a custom MU plugin would allow for you to update the Primer theme moving forward without losing any of your customizations.

    Best,
    Evan

    Thread Starter redmercer

    (@redmercer)

    Sweet! Yeah I was worried about that. I’ll give that a shot.

    Thread Starter redmercer

    (@redmercer)

    Worked like a charm! Thank you for the direction.

    For those that are interested. I followed the instructions on how to create a MU Plugin via Godaddy

    Added the following to the my-customization.php file.

    <?php
    /*
    Plugin Name: Hello World!
    */
    
    function my_own_action_function(){
    	echo "<p class='someclass'>Hello world.</p>";
    }
    add_action( 'primer_after_page_title',       'my_own_action_function',10 );
    ?>
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add content below page title’ is closed to new replies.