elbego
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallyBeautiful – you nailed it… many thanks! Now to work out how you did it…
Is it the fields => ‘ids’ that dicates the category output order?
Forum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallyWow! Thanks very much for your time on this!
Good guess on the ID – it’s actually 40!
This works to a point but outputs all sub categories of Luxury Training rather than just the sub categories that the current post is in.
Forum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallythey only have one Top level… i.e. UK or Europe etc…
Forum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallyThanks for taking the time!
Forum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallyLike this:
UK News : Luxury Training
Universities
Visit the Universities training pageForum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallySorry – it’s not very clear!
OK – this is in single.php
I want to output the top level, then second level, then if the current post is in the category ‘Luxury-training’ output the third level
Then, again, if post is in the ‘Luxury-training’ cat – output also the third level again into link tag that links to a page of same slug as the category (bit in the h2 tag).
Hope that makes sense!
Forum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallyCan’t link to page but here’s the code
This outputs correctly for this category hierarchy:
UK > Luxury Training > Restaurant (outputs: UK > Luxury > Restaurant)
But not for:
UK > Luxury Training > Universities (outputs: UK > Luxury > UK)
the order that the categories are assigned changes depending on alphabetical order??
<?php // Output post parent category name $category = get_the_category(); $parent = get_cat_name($category[0]->category_parent); if (!empty($parent)) { echo $parent; } else { echo $category[0]->cat_name; } ?> News : <?php $category = get_the_category(); $firstCategory = $category[0]->cat_name; echo $firstCategory;?> <br /> <?php if (has_term('luxury-training', 'category')) { $secondCategory = $category [1]->cat_name; echo $secondCategory; } ?> </h3> </div> <?php if (has_term('luxury-training', 'category')) {?> <h2> Visit the <a href="/<?php echo $category [1]->slug; ?>"> <?php echo $category [1]->cat_name; ?> </a> training page</h2> <?php } ?> </div>Forum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallySurely someone else had experienced this?! It comes up time after time!
Forum: Plugins
In reply to: [Contact Form 7] pure360 integrationNice one – good luck!
Forum: Fixing WordPress
In reply to: Assigning Category Hierarchy to Posts by ID not alphabeticallycould it be altered using:
wp_set_post_categories?Pleased to say I’ve sorted this!
Used a role editor plugin to assign a new capability of ‘administrator’ to the Editor!
Simple.
Cheers.
Forum: Plugins
In reply to: [Taxonomy Images] [Plugin: Taxonomy Images] get child category imageThis was my code… firstly note that the array for the taxonomy images should use term_args:
'taxonomy' => $current_term->taxonomy, 'hide_empty' => false, 'title_li' => '', 'term_args' => array( // passes info to images 'parent' => $current_term->term_id, // outputs children of current term 'hide_empty' => 0, // shows all 'orderby' => 'name', 'order' => 'ASC', 'hierarchical' => true, ),Forum: Plugins
In reply to: [Taxonomy Images] [Plugin: Taxonomy Images] Taxonomy children images.Sorted – used:
'parent' => $current_term->term_id,instead of:
child_of => $current_term->term_id,Forum: Plugins
In reply to: [Taxonomy Images] [Plugin: Taxonomy Images] get child category imageOK, Sorted – used:
‘parent’ => $current_term->term_id,
instead of:
‘child_of’ => $current_term->term_id,
stand down – managed to get ti working with:
‘parent’ => $current_term->term_id,
instead of:
child_of => $current_term->term_id,
That’s 2 days I’ll never get back!