Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daveharrisonnet/a682eba249e491b01ac13b7f085bf8c6 to your computer and use it in GitHub Desktop.
Save daveharrisonnet/a682eba249e491b01ac13b7f085bf8c6 to your computer and use it in GitHub Desktop.
<?php
function do_things_late() {
global $listify_job_manager;
$template = $listify_job_manager->template;
$childargs = '';
global $listify_navigation;
remove_action( 'wp_nav_menu_items', array( $listify_navigation, 'taxonomy_mega_menu' ), 0, 2 );
add_action( 'wp_nav_menu_items', 'modified_taxonomy_mega_menu', 0, 2 );
remove_action( 'listify_single_job_listing_actions_after', array( $listify_job_manager->template, 'submit_review_link' ) );
add_action( 'listify_single_job_listing_actions_after', 'modified_submit_review_link' );
/**
* Plugin Name: Listify - Make submit review button a modal popup
*/
function modified_submit_review_link() {
global $post;
if ( ! comments_open() || ! ( is_active_widget( false, false, 'listify_widget_panel_listing_comments', true ) || !
is_active_sidebar( 'single-job_listing-widget-area' ) ) || 'preview' == $post->post_type ) {
return;
}
if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
$url = get_permalink( 3045 );
$customclass = "popup-trigger-ajax popup-wide";
} else {
$url = apply_filters( 'listify_submit_review_link_anchor', '#respond' );
$customclass = '';
}
?>
<a href="<?php echo esc_url( $url ); ?>" class="<?php echo $customclass ?>"><span class="single-job_listing-respond button button-secondary"><?php _e( 'Submit a Review', 'listify' ); ?></span></a>
<?php
}
//remove_action( 'wp_nav_menu_items', array( $template, 'taxonomy_mega_menu' ), 0, 2 );
//add_action( 'wp_nav_menu_items', 'modified_taxonomy_mega_menu' , 20);
//add_action( 'wp_nav_menu_items', 'modified_taxonomy_mega_menu', 0, 2 );
function modified_taxonomy_mega_menu( $items, $childargs ) {
if ( 'none' == listify_theme_mod( 'nav-megamenu' ) ) {
return $items;
}
if ( 'secondary' != $childargs->theme_location ) {
return $items;
}
$taxonomy = get_taxonomy( listify_theme_mod( 'nav-megamenu' ) );
if ( is_wp_error( $taxonomy ) ) {
return $items;
}
global $listify_strings;
$link = sprintf(
'<a href="%s">' . __( 'Browse ALL %s', 'listify' ) . '</a>',
get_post_type_archive_link( 'job_listing' ),
str_replace( $listify_strings->label( 'singular' ) . ' ', '', $taxonomy->labels->name )
);
$submenu = wp_list_categories( apply_filters( 'listify_mega_menu_list', array(
'taxonomy' => $taxonomy->name,
'hide_empty' => 1,
'pad_counts' => true,
'show_count' => true,
'echo' => false,
'title_li' => false,
'depth' => -1,
'walker' => new Listify_Walker_Category
) ) );
$link1 = '<a href="/listings/things-to-do">Things To Do</a>';
$submenu1 = wp_list_categories( apply_filters( 'listify_mega_menu_list', array(
'taxonomy' => $taxonomy->name,
'child_of' => 146,
'hide_empty' => 1,
'pad_counts' => true,
'show_count' => true,
'echo' => false,
'title_li' => false,
'depth' => -1,
'walker' => new Listify_Walker_Category
) ) );
$link2 = '<a href="/listings/services">Services</a>';
$submenu2 = wp_list_categories( apply_filters( 'listify_mega_menu_list', array(
'taxonomy' => $taxonomy->name,
//'child_of' => 480,
'child_of' => 254,
'hide_empty' => 1,
'pad_counts' => true,
'show_count' => true,
'echo' => false,
'title_li' => false,
'depth' => -1,
'walker' => new Listify_Walker_Category
) ) );
$link3 = '<a href="/listings/lifestyle">Lifestyle</a>';
$submenu3 = wp_list_categories( apply_filters( 'listify_mega_menu_list', array(
'taxonomy' => $taxonomy->name,
'child_of' => 159,
//child_of' => 481,
'hide_empty' => 1,
'pad_counts' => true,
'show_count' => true,
'echo' => false,
'title_li' => false,
'depth' => -1,
'walker' => new Listify_Walker_Category
) ) );
$dropdown = wp_dropdown_categories( array(
'show_option_all' => sprintf( __( 'Select a %s', 'listify' ), str_replace( $listify_strings->label( 'singular' ) . ' ', '', $taxonomy->labels->singular_name ) ),
'taxonomy' => $taxonomy->name,
'hide_empty' => 0,
'pad_counts' => false,
'show_count' => true,
'echo' => false,
'title_li' => false,
'depth' => 0,
'hierarchical' => true,
'name' => $taxonomy->name,
'walker' => new Listify_Walker_Category_Dropdown
) );
$dropdown1 = wp_dropdown_categories( array(
'show_option_all' => sprintf( __( 'Select a %s', 'listify' ), str_replace( $listify_strings->label( 'singular' ) . ' ', '', $taxonomy->labels->singular_name ) ),
'taxonomy' => $taxonomy->name,
'child_of' => 146,
'hide_empty' => 0,
'pad_counts' => false,
'show_count' => true,
'echo' => false,
'title_li' => false,
'depth' => 0,
'hierarchical' => true,
'name' => $taxonomy->name,
'walker' => new Listify_Walker_Category_Dropdown
) );
$dropdown2 = wp_dropdown_categories( array(
'show_option_all' => sprintf( __( 'Select a %s', 'listify' ), str_replace( $listify_strings->label( 'singular' ) . ' ', '', $taxonomy->labels->singular_name ) ),
'taxonomy' => $taxonomy->name,
'child_of' => 254,
'hide_empty' => 0,
'pad_counts' => false,
'show_count' => true,
'echo' => false,
'title_li' => false,
'depth' => 0,
'hierarchical' => true,
'name' => $taxonomy->name,
'walker' => new Listify_Walker_Category_Dropdown
) );
$dropdown3 = wp_dropdown_categories( array(
'show_option_all' => sprintf( __( 'Select a %s', 'listify' ), str_replace( $listify_strings->label( 'singular' ) . ' ', '', $taxonomy->labels->singular_name ) ),
'taxonomy' => $taxonomy->name,
'child_of' => 159,
'hide_empty' => 0,
'pad_counts' => false,
'show_count' => true,
'echo' => false,
'title_li' => false,
'depth' => 0,
'hierarchical' => true,
'name' => $taxonomy->name,
'walker' => new Listify_Walker_Category_Dropdown
) );
$submenu =
'<ul class="sub-menu category-list">' .
'<form id="job_listing_tax_mobile" action="' . home_url() . '" method="get">' . $dropdown . '</form>
<div class="container">
<div class="mega-category-list-wrapper">' . $submenu . '</div>
<!--<a href="' . get_post_type_archive_link( 'job_listing' ) . '">' . __( 'View All', 'listify' ) . '</a>-->
</div>
</ul>';
$submenu1 =
'<ul class="sub-menu category-list">' .
//'<form id="job_listing_tax_mobile" action="' . home_url() . '" method="get">' . $dropdown1 . '</form>
'<div class="container">
<div class="mega-category-list-wrapper">' . $submenu1 . '</div>
<!--<a href="' . get_post_type_archive_link( 'job_listing' ) . '">' . __( 'View All', 'listify' ) . '</a>-->
</div>
</ul>';
$submenu2 =
'<ul class="sub-menu category-list">' .
//'<form id="job_listing_tax_mobile" action="' . home_url() . '" method="get">' . $dropdown2 . '</form>
'<div class="container">
<div class="mega-category-list-wrapper">' . $submenu2 . '</div>
<!--<a href="' . get_post_type_archive_link( 'job_listing' ) . '">' . __( 'View All', 'listify' ) . '</a>-->
</div>
</ul>';
$submenu3 =
'<ul class="sub-menu category-list">' .
//'<form id="job_listing_tax_mobile" action="' . home_url() . '" method="get">' . $dropdown3 . '</form>
'<div class="container">
<div class="mega-category-list-wrapper">' . $submenu3 . '</div>
<!--<a href="' . get_post_type_archive_link( 'job_listing' ) . '">' . __( 'View All', 'listify' ) . '</a>-->
</div>
</ul>';
return '<li id="categories-mega-menu" class="ion-navicon-round menu-item menu-type-link">'. $link . $submenu .'<li id="categories-mega-menu" class="ion-navicon-round menu-item menu-type-link">'. $link1 . $submenu1 . '<li id="categories-mega-menu" class="ion-navicon-round menu-item menu-type-link">'. $link2 . $submenu2 . '<li id="categories-mega-menu" class="ion-navicon-round menu-item menu-type-link">'. $link3 . $submenu3 . '' .$items;
}
}
add_action( 'init', 'do_things_late', 20 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment