Thank you very much for the new version 2.5.1.
Please look at the below error due to the ‘if (sizeof($taxonomies) == 0)’
Error: More than 1 heirachical taxonomy detected. You must assign a default taxonomy on the settings screen.
Most of the sites are working with custom taxonomies. in that scenario, it creates an error.
I have tried to use general taxonomy “categories” for category replace. but no use.
Please solve this error. In the previous version, there was no problem.
]]>I am using OceanWP Version: 1.7.4 and have noticed a problem with the breadcrumb function.
The page title breadcrumb for hierarchical taxonomies is incorrectly constructed.
For an example category hierarchy of a > b > c > d, the breadcrumb c > b > a > d is produced.
I can’t find any option to change the sequence in Themes / Customisation. Is there any way of doing this from within WordPress?
The problem seems to be caused by oceanwp/inc/breadcrumb.php:function add_term_parents( $term_id, $taxonomy ) not actually reversing $parents array.
Change lines: 1293-1295
from:
// If we have parent terms, reverse the array to put them in the proper order for the trail.
if ( !empty( $parents ) )
$this->items = array_merge( $this->items, $parents );
to:
// If we have parent terms, reverse the array to put them in the proper order for the trail.
if ( !empty( $parents ) )
$this->items = array_merge( $this->items, array_reverse( $parents ) );
]]>Preamble:
We are creating a website where people look for professionals for some home working.
We want to create a homepage with a search bar where people write the profession/category (actually it is a custom taxonomy) that they need, like ‘plumbers’, and a dropdown/checkbox filter where they can choose the city where they need the plumber.
The result page is a list of plumber agencies in the city chosen. Each agency is a Custom Post Type for us.
Furthermore, we are hardly working to make our SEO ranking as high as possible.
So, for example, we know that it is important to have a well-done Archive Page for each Taxonomy term, besides a well-done Results Page.
Also, we know it is bad for SEO to have duplicated pages or (maybe) similar pages, ranking for the same (or maybe also similar) keywords.
Proposed Structure:
So, what we are thinking is to have this structure:
A unique hierarchical taxonomy that INCLUDES the City AND the profession!
That means that our taxonomy ‘taxonomy_unique’ has terms like: ‘Rome’, ‘Paris’, ‘Dublin’ as father and also terms like ‘Plumbers’, ‘Gardeners’, ‘Electricians’ which are sons of some City father!
So we will have the term ‘Plumbers’ son of ‘Rome’ and we will have also the term ‘Plumbers’ son of ‘Paris’. Each of these two taxonomy terms (Rome/Plumbers and Paris/Plumbers) will have an archive page that we want to make ranking for the keywords ‘Plumbers in Rome’ and ‘Plumbers in Paris’ respectively.
It is easier to think of it imagining the breadcrumbs. They will be:
Home > Rome > Plumbers
and
Home > Paris > Plumbers
Both will have:
– a static content (important for SEO), where we describe the plumber profession with a focus on the city, like ‘Find the best Plumbers in Rome’ vs ‘Find the best Plumbers in Paris’
– a ‘dynamic’ content – below – that is a list of Custom Post Types which have that taxonomy term associated.
Furthermore, also ‘Rome’ and ‘Paris’ are taxonomy terms that have their own archive page. In those pages, we are thinking to show the Custom Post Types (agencies) associated with that taxonomy term as a father OR maybe just a list of the ‘sons’ of that father, so links to those archive pages ‘sons’).
In both cases, there should be also a static content talking maybe about the city and the professionals it offers in general.
Questions:
So what we would like to understand is:
1) Is it bad from an SEO perspective to have 2 URLs that look like this:
www.mysite.com/Rome/Plumbers
and
www.mysite.com/Naples/Plumbers
where the static content is really similar and it is something like that:
“Are you looking for the best plumbers in the city of Rome”
and
“Are you looking for the best plumbers in the city of Naples”?
Also, these kinds of pages will be much more than 2, one for each City.
We are doing that because we want the two different pages to rank high in two different cities, but we are not sure if Google likes that.
2) On the other hand, each City will have one page for each kind of job, so:
www.mysite.com/Rome/Plumbers
www.mysite.com/Rome/Gardeners
www.mysite.com/Rome/Electricians
So the same question, does Google like this or not?
3) About ‘Rome’ and ‘Paris’ archive pages, does Google prefer a list of Custom Post Types that have that father term associated as taxonomy, or a list of the archive pages ‘sons’, with links to those pages?
What do you think about this approach? ?Do you think this structure could be good from an SEO perspective, or maybe there could be something better alternatively?
Hoping everything is clear, we really appreciate anyone dedicating its time and leaving feedback.
Daniele
– Post belongs to the parent custom taxonomy and any subcategories of the same parent taxonomy.
Let’s say, custom taxonomy is called custom_taxonomy and it has a category ‘Animals’ ID=01 (Parent)
Subcategories of ‘Animals’ are ‘Beagle’ ID=02 and ‘Retriever’ ID=03.
It’s easy with plain post categories and child subcategories.
if (is_category('Animals') || cat_is_ancestor_of('Animals', get_query_var( 'cat' )) { echo 'Successs';
How do I check whether the post belongs to a subcategory of taxonomy parent category ‘Animals’ ID=01?
The first part works fine, but I have like 50 subcategories and I’m certain there should be a better way than listing them one by one.
is_tax('custom_taxonomy', 'Animals') ) ||
I would like to know if you plan to support hierarchical taxonomies.
Right now, it only show the first level of taxonomies and all children taxonomies are not present. (Parent taxonomies are greyed out).
Thanks you.
]]>I’m trying to set the post title of a custom post type (on submit) to include values from a custom taxonomy which is hierarchical.
I can get the page title to update, but the taxonomy terms are in alphabetical order.
I’ve tried to implement code that I’ve used elsewhere to display the taxonomy in hierarchical order, but it doesn’t seem to be working within my function.
Code to update page title:
function custom_post_type_title ( $post_id ) {
global $wpdb;
if ( get_post_type( $post_id ) == 'custom-post-type') {
$taxonomy = 'taxonomy' //change as appropriate
//$terms = wp_get_object_terms($post_id, $taxonomy);
//$tax_1 = ' '.$terms[0]->name;
//$tax_2 = ' '.$terms[1]->name;
//$tax_3 = ' '.$terms[2]->name;
$title = $tax_1.$tax_2.$tax3;
$where = array( 'ID' => $post_id );
$wpdb->update( $wpdb->posts, array( 'post_title' => $title ), $where );
}
}
add_action( 'save_post', 'custom_post_type_title' );
The code above successfully writes or overwrites the post title on submit – just in alphabetical order and not hierarchical.
I’ve used the code below in my single custom post type template to display the taxonomy in the correct order and it works:
$rd_taxonomy = 'custom_taxonomy_name'; //taxonomy
$rd_terms = wp_get_post_terms( $post->ID, $rd_taxonomy, array( "fields" => "ids" ) ); // getting the term IDs
if( $rd_terms ) {
$term_array = trim( implode( ',', (array) $rd_terms ), ' ,' );
$neworderterms = get_terms($rd_taxonomy, 'orderby=none&include=' . $term_array );
foreach( $neworderterms as $orderterm ) {
$cpt_post_title[] = $orderterm->name;
}
}
$parent = $cpt_post_title[0];
$child = $cpt_post_title[1];
$grandchild = $cpt_post_title[2];
echo $parent.' '.$child.' '.$grandchild;
Can anyone help get these 2 functions working?
Thanks in advance.
]]>https://www.ads-software.com/extend/plugins/file-gallery/
]]>I’m using a custom post type of job listings for a WP powered job board. Each of these jobs have a state and city location.
I’d like to have a page where users could browse jobs by location. This page would have a listing of all 50 “States” which are hyperlinked to search results for those states.
Underneath each “State” link I would like links to search results for each “City” that has active job listings.
I understand you can specify a tax as hierarchical when you register it, but there is no way to say to which other taxes it is a child or parent.
Further,
]]>I used this code in functions.php:
function create_pc_db_taxonomies() { register_taxonomy( 'course', 'post', array( 'hierarchical' => false, 'label' => __('Course subject', 'series'), 'query_var' => 'course', 'rewrite' => array( 'slug' => 'courses' ) ) ); register_taxonomy( 'type', 'post', array( 'hierarchical' => false, 'label' => __('Type of opportunity', 'series'), 'query_var' => 'type', 'rewrite' => array( 'slug' => 'types' ) ) ); } ?>
which works absolutely fine, but I want hierarchical (category-style) admin boxes rather than tag-style admin boxes.
However, when I set hierarchical' => true
so that the above code becomes:
function create_pc_db_taxonomies() { register_taxonomy( 'course', 'post', array( 'hierarchical' => true, 'label' => __('Course subject', 'series'), 'query_var' => 'course', 'rewrite' => array( 'slug' => 'courses' ) ) ); register_taxonomy( 'type', 'post', array( 'hierarchical' => true, 'label' => __('Type of opportunity', 'series'), 'query_var' => 'type', 'rewrite' => array( 'slug' => 'types' ) ) ); } ?>
I get no boxes at all.
Am I doing something wrong? Thanks!
]]>