WP SITES

2952 Tutorials & 191 Plugins

Add Button To Entries On Archive Pages

This code enables you to add a button with a unique link after entries on archive pages in genesis like you see in this example :

Code

The code adds the button after the content, content limit or excerpt on all archive pages. The link for the button is unique.

Installation

  • Copy & paste the PHP code to the end of your child themes functions file.
  • Add a new custom field on any Edit Post screen using link as the field name and the link URL as the value like you see in the following screenshot :

Different Archive Page Types

You can add the button on custom post types archives by changing the conditional tag !is_single() to is_post_type_archive('portfolio') assuming your CPT is named portfolio otherwise swap out portfolio with the name of your custom post type.

Usage On Single Entries

You can add the button on single custom post type pages by changing the conditional tag !is_single() to is_singular('portfolio') assuming your CPT is named portfolio otherwise swap out portfolio with the name of your custom post type.

Positioning Button

You have 2 choices :

  1. You can change the genesis_entry_content hook to another hook like genesis_entry_footer to change the position the button displays after the entry.
  2. Or, you can change the 3rd parameter from 15 to another value to control the timing of the execution of the hook.

Related Tutorials

Was This Tutorial Helpful?