latext
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Character encoding problem after restoring from backupI guess I can answer my own post (with the help of a Swedish friend):
The “mysql” command used to restore the db from the backup needs one additional argument:
–default_character_set=utf8
With that, the UTF8 encoding is correctly preserved.
But in the codex page for the tag at
https://codex.www.ads-software.com/Template_Tags/single_cat_title
it says:
display
(boolean) Display the category ID (TRUE) or return it for use in PHP (FALSE). Defaults to TRUE.Thanks guys. Works fine. Any reason why the single_cat_title() tag doesn’t work as documented? Or am I misunderstanding what it does and what it’s for?
Forum: Fixing WordPress
In reply to: needs testing: pMachine 2.3 to WP 1.2 converterI’ve just written a post describing my own experience switching from pMachine Pro 2.3 to WordPress 1.5. Thought some people here might find it interesting:
https://www.betalogue.com/2005/07/16/from-pmachine-to-wordpress/
Forum: Fixing WordPress
In reply to: needs testing: pMachine 2.3 to WP 1.2 converterpepsifreak: In my experience, the script works fine from pM Pro 2.3 to WP 1.5 directly. You only need to install WP directly into the same directory as pMachine.
Forum: Fixing WordPress
In reply to: PMachine to WordPress – How to pull your entries?xaebaby: your Downloads area says “File not found”.
Forum: Fixing WordPress
In reply to: Post authors not getting notified of commentsFound a solution myself:
Forum: Plugins
In reply to: Sortable nicer archives for WordPress 1.2SOLUTION for those who, like me, had problems with the Nicer Archives mod only showing a limited number of posts when sorted by Date or by Title — thanks to LL, I was able to identify the problem, which was some commented out code in the page that was still processed as PHP code:
https://www.latext.com/pm/betalogue/P1394
This eliminates the need for the ugly hack described in my previous post.
Forum: Plugins
In reply to: Sortable nicer archives for WordPress 1.2Nice mod, except that it doesn’t seem to be working right with WordPress configured to display only a limited number of items per page. The limitation also applies to this mod when sorted by Date or by Title! (but not when sorted by Category). Not much point in viewing a list of items sorted by date or title if you only get to see the first 10 or 15 of them!
I ended up finding a rather ugly work-around:
https://www.latext.com/pm/comments/P1393_0_1_0/
Needless to say, I’d prefer something more elegant, but that’s all I could do with my very limited knowledge of PHP and mySQL.
Forum: Fixing WordPress
In reply to: How to query posts that are in category A and category B?Well, it seems to be a problem with
category_cache
, because I wrote a new function instead:
function in_categorie($category) { // Check if the current post is in the given category
global $post, $tablecategories, $tablepost2cat, $wpdb;
$cats = '';
$categories = $wpdb->get_results("
SELECT category_id, cat_name, category_nicename, category_description, category_parent
FROM $tablecategories, $tablepost2cat
WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID
");foreach ($categories as $cat) :
$cats[] = $cat->category_id;
endforeach;if ( in_array($category, $cats) )
return true;
else
return false;}
and it works with that new function!
That being said, I am not really satisfied with this approach, because it effectively just filters out the posts IN THE CURRENT REQUEST that do not match the conditions. The problem with this is that there is no way to tell in advance if the page is going to contain ANY posts and then, if some posts do match the conditions, on a page-based system, that means some pages can have 3 posts while other pages might have 5 posts, etc.
What I would really like is code that actually ONLY requests from the database those posts that do match the conditions, so that I can tell right away if there are no posts that match the conditions, and also so that I can control how many posts per page I am going to get.
Is this possible without becoming a WordPress expert? :-/
Forum: Fixing WordPress
In reply to: How to query posts that are in category A and category B?Zeeg: Thanks. It’s ALMOST working. There’s one problem left: For some reason, WP only displays those posts that are in category 1 — in ADDITION to the criteria defined by the parameters. In other words, if I use
https://www.mysite.com/index.php?category1=2&category2=3
WP behaves as if I had requested posts that are in categories 1, 2 and 3. There’s something somewhere that makes WP think that I only want posts that meet my criteria AND are also in category 1.
How come, and how do I eliminate this additional condition that I do not want?
Forum: Fixing WordPress
In reply to: How to query posts that are in category A and category B?OK, I’m getting there. I’ve figured out that
<?php if (in_category(‘1’) and in_category(‘2’)) : ?>
will display only posts that are in BOTH category 1 and category 2.
Now all I need to do is pass “1” and “2” as parameters in my URI, i.e. something like:
https://www.mysite.com/index.php?category1=1&category2=2
Is this possible?
Forum: Fixing WordPress
In reply to: How to query posts that are in category A and category B?Thanks for your reply. I find it hard to believe that this cannot be done without advanced scripting! I am afraid I know very little about PHP and have no idea how to do this. Surely there must be an easy way… if not through a URI, then through a form? (although I’d prefer the ability to provide a direct link)
Forum: Fixing WordPress
In reply to: mod_rewrite in Panther Server (Mac OS X Server 10.Thanks for the tip. Actually, I ended up putting the rules in the conf file for the site instead of using .htaccess, and it works fine now.