Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to trigger popups on archive pages #16

Open
siamkreative opened this issue Aug 20, 2015 · 2 comments
Open

Ability to trigger popups on archive pages #16

siamkreative opened this issue Aug 20, 2015 · 2 comments
Assignees

Comments

@siamkreative
Copy link
Member

As suggested here: https://wordpress.org/support/topic/want-to-show-popup-on-different-category?replies=2

Added to the roadmap #13

@siamkreative siamkreative mentioned this issue Aug 20, 2015
3 tasks
@siamkreative siamkreative changed the title Ability to trigger popups on categories pages Ability to trigger popups on archive pages Mar 11, 2016
@siamkreative
Copy link
Member Author

Would be good to list categories that eCommerce plugins adds:

  • EDD
  • WooCommerce

This would allow users to create an opt-in popup for a specific category. For instance, I want to create an opt-in popup to get a free keyboard on the category laptop.

@siamkreative
Copy link
Member Author

http://stackoverflow.com/a/21012252/1414881

<?php

  $taxonomy     = 'product_cat';
  $orderby      = 'name';  
  $show_count   = 0;      // 1 for yes, 0 for no
  $pad_counts   = 0;      // 1 for yes, 0 for no
  $hierarchical = 1;      // 1 for yes, 0 for no  
  $title        = '';  
  $empty        = 0;

  $args = array(
         'taxonomy'     => $taxonomy,
         'orderby'      => $orderby,
         'show_count'   => $show_count,
         'pad_counts'   => $pad_counts,
         'hierarchical' => $hierarchical,
         'title_li'     => $title,
         'hide_empty'   => $empty
  );
 $all_categories = get_categories( $args );
 foreach ($all_categories as $cat) {
    if($cat->category_parent == 0) {
        $category_id = $cat->term_id;       
        echo '<br /><a href="'. get_term_link($cat->slug, 'product_cat') .'">'. $cat->name .'</a>';

        $args2 = array(
                'taxonomy'     => $taxonomy,
                'child_of'     => 0,
                'parent'       => $category_id,
                'orderby'      => $orderby,
                'show_count'   => $show_count,
                'pad_counts'   => $pad_counts,
                'hierarchical' => $hierarchical,
                'title_li'     => $title,
                'hide_empty'   => $empty
        );
        $sub_cats = get_categories( $args2 );
        if($sub_cats) {
            foreach($sub_cats as $sub_category) {
                echo  $sub_category->name ;
            }   
        }
    }       
}
?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants