nihtrepap
Forum Replies Created
-
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Subcategory open by itselfThat seems like to do the job, great support man!
Will give you feedback about the results if you want!
Big thanks π
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Subcategory open by itselfHello!
I have activated Test category with 2 TestSub categories.
Click around and you will see what I mean.
They open up even when you don’t even click the Test category.This needs to be fixed, and it do not look like it is to do with my code.
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Subcategory open by itselfHey.
Yeah I know this might be confusing, but there is no error on that page you linked. It were merely used as an example page for the image made.I would prefer not to activate that as it is not something we want to have as it works right now.
But if it is a must then sure. I could not see any console errors, thought I can check again.
I just don’t want the random subcategories to show if not clicked. As i said in the example beten is clicked, but beten has no subcategories. Parent has subcategories and for some reason they show up when clicking at beten.
I just want to see the “parent” category there and not in an opened state. As it were bot clicked
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Subcategory open by itselfHey.
Okey this is now way off.
We need to back it up abit, my explanation has taken you way out of the real problem.I will try again from the beginning.
child1, child2 and child3 are example subcategories to have something to show you.
They belong to the “Parent” Category, wich also is an example category.
“Parent” category is the parent to the “child1″,”child2” and “child3” subcategories.Here is an updated image:
So the strange thing is that “Parent” category opens up and show “child1”, “child2” and “child3” even when it is not clicked.
“Parent” and it subcategories are not used because it is only an example to show you, so this problem will not show itself on the page. Sorry for the mislead.
I hope this made it clear?
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Subcategory open by itselfHey,
Yes it did look like your code were doing just that.
The image were just an example, I will try to better explain.
Image:That image show you that the parent category opens up even if you don’t click just that. So it show you that I clicked on category beten, yet category parent opens up and show all subcategories. That i do not want to happen, imagine having alot of subcategories on different parents and they all open up even when you don’t click it. It gets messy.
Edit: I only want subcategories to show when I clicked on the parent category of the subcategories. Not when I click any random category.
Hopefully clearer? π
/ Philip
- This reply was modified 5 years, 1 month ago by nihtrepap.
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Subcategory open by itselfHey!
There is no more codesnippets used than that.
That code did not fix it, now we can’t open the parent.
It shows the classifieds inside but not showing the childs inside.Any other idea? This is a feature we really need π
/Philip
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Subcategory open by itselfThansk for a fast response!
I will send images for the 3 codesnippets we are using, my guess is that something might be going wrong with codeSnippetThree.
Codesnippets:
1-add_action( "adverts_sh_list_before", "categories_above_adverts_list" ); function categories_above_adverts_list( $args ) { global $wp_query; if( is_tax( 'advert_category' ) ) { $current_category = $wp_query->get_queried_object_id(); // code for getting the sub categories and displaying them here $columns = "adverts-flexbox-columns-4"; $show_count = 1; $terms = get_terms( 'advert_category', array( 'hide_empty' => 0, 'number' => 0 ) ); include ADVERTS_PATH . '/templates/categories-top.php'; } }2-
add_action( "wp_footer", function() { if( ! is_tax( 'advert_category' ) ) { return; } $term = get_queried_object(); ?> <style type="text/css"> .adverts-category-slug-<?php echo $term->slug ?> { background-color: lightgrey !important; } </style> <?php });3-
/** Plugin Name: WPAdverts Snippets - Search by category Version: 1.0 Author: Greg Winiarski Description: Adds categories dropdown input to [adverts_list] search bar. */ // The code below you can paste in your theme functions.php or create // new plugin and paste the code there. add_filter( 'adverts_form_load', 'search_by_category_form_load' ); add_filter( 'adverts_list_query', 'search_by_category_query' ); /** * Adds category dropdown into search form in [adverts_list]. * * @param array $form Search form scheme * @return array Customized search form scheme */ function search_by_category_form_load( $form ) { if( $form['name'] != 'search' ) { return $form; } $form['field'][] = array( "name" => "category_search", "type" => "adverts_field_select", "order" => 20, "label" => __("Kategorier", "adverts"), "max_choices" => 10, "options" => array(), "options_callback" => "adverts_taxonomies", "meta" => array( "search_group" => "visible", "search_type" => "full" ) ); return $form; } /** * Adds tax_query param to WP_Query * * The tax_query is added only if it is in $_GET['advert_category'] * * @param array $args WP_Query args * @return array Modified WP_Query args */ function search_by_category_query( $args ) { if( ! adverts_request( "category_search" ) ) { return $args; } $args["tax_query"] = array( array( 'taxonomy' => 'advert_category', 'field' => 'term_id', 'terms' => adverts_request( "category_search" ), ), ); return $args; }4-
/* * Plugin Name: Enable Adverts Comments. * Plugin URI: http://wpadverts.com/ * Description: This code snippet/plugin enables comments on ads. * Author: Greg Winiarski */ add_filter( "adverts_tax_shortcode_args", function( $args ) { $args["allow_sorting"] = 1; return $args; } ); add_action("adverts_post_type", "enable_adverts_comments"); add_action("adverts_insert_post", "enable_adverts_comments_check"); add_action("adverts_update_post", "enable_adverts_comments_check"); /** * Enables comments in Ads * * This will enable support for comments in wp-admin panel when editing Ad. * * Note you can use this function to further customize Adverts Custom Post Type the * $args argument is "$args" used in register_post_type function. In other words * this function (or rather "customize_post_type" filter) gives you an opportunity * to customize adverts Custom Post Type parameters before * register_post_type function will be called. * * @see register_post_type() * @link https://codex.ww.wp.xz.cn/Function_Reference/register_post_type * * @param array $args Custom Post Type init params * @return array */ function enable_adverts_comments( $args ) { $args["supports"][] = "comments"; return $args; } /** * Set Ad comment status to "open". * * Sets comment_status field to open for a single Ad, this will allow users * to post comment below an Ad. * * @param array $data * @return array Updated $data */ function enable_adverts_comments_check( $data ) { $data["comment_status"] = "open"; return $data; }My guess is that it has something to do with number 3, but dunno.
I will also attach two images with example of how it looks, second image is when clicked into any other category except parent. child categories are subcategories of Parent category in this test.
Picture 1 shows just how it looks from start page.
Could not find any attach file thingy so i used imgur:
picture 1 – https://imgur.com/OOREWBj
picture 2 – https://imgur.com/cPoo3zxThanks,
Philip