metalmustache
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: 'Number' of post, out of 'Total Number of Posts'I actually ended up finding (after a lot of digging) this post that helped me out:
https://www.transformationpowertools.com/wordpress/continuous-post-numbers
After putting his function setup in my function.php file, I took his php and mashed it up with some other code that I found (unfortunately I can’t remember where i found it), and ended up with this for the between my previous and next buttons in my single.php file:
<?php $num_posts = wp_count_posts( 'post' ); $num_posts = $num_posts->publish; //publish, draft $num_posts = sprintf( number_format_i18n( $num_posts ) ); echo '<p>project ' . get_post_meta($post->ID,'incr_number',true) . ' of ' . $num_posts . '</p>'; ?>
The result now shows up as eg:
project 3 of 37hope that helps.
Forum: Fixing WordPress
In reply to: 'Number' of post, out of 'Total Number of Posts'Hi guys – just wondering if you ever solved this?
If so, would you mind posting the code for me to take a look at?
Andrew – that’s fantastic, thanks! Works perfectly.
As for the term order thing, that’s not a problem (and either way, I haven’t actually seen it have any effect anywhere besides the faceted search widget).
Okay. This is the LAST question, promise: Can you think of a way to get the widget to repopulate itself with categories relevant to ones that have already been selected? For example – I run a small animation studio. Here’s what a sample of my search widget is populated with:
Job Type
– 2d
– 3d
Subject
– Characters
– Backgrounds
– LogosSo, ideally, if a client clicks the 3d box, but I only have posts marked with the category combinations: ‘3d / Characters’, and ‘3d / Backgrounds’, then ‘Logos’ would disappear from the list.
This would keep people from getting any empty page results due to searching for combos that don’t exist.
Thanks again;
MaxThanks a lot for the tip, Andrew – it didn’t quite do the trick, but it did get me to learn about accessing the database tables and filling in the term_order column in the wp_terms table.
In the end, I just made this simple little switch to the code:
‘ORDER BY t1.term_order ASC’
Works perfectly. I’m labeling parent categories in the 1000s, and child categories in the 100s – this leaves me lots of room to insert numbers of new categories down the road.
One more quick question:
I’ve been using a similar set up that had a slice of code in it that meant top-level categories wouldn’t have checkboxes, and I could also style them to look like headers for the sub cats. The code looks like this:‘if ($subcat_level == 0)
echo “<h4>”.$a_cat->name.”</h4>”;
else’Can you think of how I could implement something similar inn your code?
Thanks a lot for all your help.
Max