Skip to content

Instantly share code, notes, and snippets.

@turtlepod
Last active August 24, 2017 02:23
Show Gist options
  • Save turtlepod/3f6ef730666cfff2daa3e1d2ae49bfc0 to your computer and use it in GitHub Desktop.
Save turtlepod/3f6ef730666cfff2daa3e1d2ae49bfc0 to your computer and use it in GitHub Desktop.
Add a button to the main single hero actions in Listify. Add 'button-secondary' class to change the color to the accent color.
<?php
/**
* Plugin Name: Listify - Custom Single Listing Hero Button
*/
function custom_listify_single_job_listing_actions_after() {
global $post;
// Get URL.
$url = get_post_meta( $post->ID, 'your_custom_meta_key', true );
// Get checkbox (ticket button enabled)
$enabled = get_post_meta( $post->ID, 'ticket_button', true );
// Check if URL exists and ticket button enabled.
if ( $url && $enabled ) {
echo '<a href="' . esc_url( $url ) . '" class="button">My Button</a>';
}
}
add_filter( 'listify_single_job_listing_actions_after', 'custom_listify_single_job_listing_actions_after' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment