• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

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

  • How To Centre a Button

Custom Fields

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems