Forum Replies Created

Viewing 15 replies - 1 through 15 (of 80 total)
  • Thread Starter Orin

    (@orin)

    I managed to fix the problem by adding this (extremely hack-y) code into my theme’s functions.php file:

    function correct_att_tag_count($att_id) {
    		if ( !current_user_can( 'edit_posts', $att_id) ) {
    		return;
    	}
    
    	global $wpdb;
    
    	$att_tags = $wpdb->get_results( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'attachment_tag' " );
    
    	foreach( $att_tags as $tag ) {
    		$tag->count = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->term_relationships WHERE term_taxonomy_id = $tag->term_taxonomy_id " );
    		$wpdb->query( "UPDATE $wpdb->term_taxonomy SET count = $tag->count WHERE term_taxonomy_id = $tag->term_taxonomy_id");
    	}
    }
    
    add_action( 'edit_attachment', 'correct_att_tag_count');

    This has fixed the immediate problem with the ‘count’ field of the term_taxonomy database, which is used by WordPress functions such as wp_tag_cloud. It’s rather inefficient as it uses 2 SQL queries iterating through every tag (not just the ones that need updating) although it works well in my non-robust tests. There should probably be a nonce check, but I couldn’t find the correct method to do so for terms.

    Anyway, if anyone needs it… this is a good start.

    Thread Starter Orin

    (@orin)

    Huh. Actually, I think it has something to do with so many of them not being assigned to a parent post.

    That is kind of weird. Hm. I’d first suggest moving away from category__not_in; it’s become more problematic since 3.1.

    where you have
    array( 'category__not_in' => array( '3', '8', '15' ) )

    try changing it to
    array( 'cat' => '-3,-8,-15' ) )

    Just to confirm, I had the same problem and fixed it by deactivating The Events Calender plugin, then changing permalinks to default. One can safely change them back after, as this resolves the issue.

    I looked through the whole changelog of 3.1, but for the life of me I can’t figure out what kind of code would cause this error. Oh well, at least it’s fixable.

    This is 100% something that was added in the last year. I was able to make child pages with numerical slugs before that. I had /twitter-archive/2009/, but can’t make /twitter-archive/2010/. And when I go to make any changes to these old child pages, WordPress wants to automatically change the slugs!

    Yeah. I don’t know what changed (I suspect: how slugs are checked against the rewrite rules) but this kind of sucks. Just have to use letters, somehow. Oh well.

    @jazfotodesign It does change the “Protected:” text site-wide, but you can easily remove that text entirely and instead simply title your posts things like “Password Required: New Pictures”.

    I wrote a plugin which will do just this, but without having to modify your core files. You can safely upgrade and not break your modifications:

    Protected Post Personalizer

    The code suggested by MichaelH worked well for me when I wanted to reset my _posts table ID after a number of annoying revisions (when I thought I had revisions disabled). I did, of course, back up the table beforehand. Thanks for the help!

    Oh dear! Well, I’m sorry I didn’t see this conversation earlier. That misplaced line break that caused you so much trouble was there for a few hours before I noticed it, and immediately re-uploaded a clean version. So sorry!

    For future reference, most WordPress plugins in the repository have a location where you can find previous versions. The Protected Post Personalizer’s is located here.

    On my WordPress site, I’ve borrowed some code from The Engineered Boulderer’s Word Count Plugin. Define this function once anywhere before you want to use it:

    <?php
    function word_count($display = false) {
        global $wpdb, $id;
    	$post = $wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $id");
    	$post_content = apply_filters('the_content', $post);}
    	$words = trim(strip_tags($post_content));
    	if( $words == '' ) {
    		$wordcount = 0;
    	} else {
    		$words = explode(' ', $words);
    		$wordcount = count($words);
    	}
    	if( $display ) {
    		echo $wordcount; }
    	else {
    	return $wordcount; }
    } ?>

    I use it to customize the size of the font, depending on how long the post is. Shorter posts get a lot more balance that way. I’m sure you could adapt my code for your purposes:

    <?php if(function_exists('word_count')) {
    	$words = word_count();
    	if (200<$words && $words<=240) echo 'style="font-size:98%"';
    	elseif (240<$words && $words<=285) echo 'style="font-size:97%"';
    	elseif (285<$words && $words<=360) echo 'style="font-size:95%"';
    	elseif (360<$words) echo 'style="font-size:94%"';
    }
    ?>

    To spell out what can be said in other, more complicated ways: it is a setting on your hosts server that you are able to change (hopefully). I created a text document called ‘php.ini’ with the following lines:

    upload_max_filesize = 30M
    post_max_size = 40M

    Which would give a maximum size of 30 MB, if my guess is correct. The way I heard it, post_max_size should always be a bit larger than upload_max_filesize, although how much larger is ambiguous.

    After I saved that file, I uploaded it to my wp-admin directory—this is important, since it’s the directory that matters here. Replace my MB values with your own, and this should be the solution you want.

    Forum: Plugins
    In reply to: Private Categories

    I think this support thread might be helpful to you.

    Forum: Plugins
    In reply to: New Plugin: JPF Register
    Orin

    (@orin)

    The link doesn’t seem to work anymore, but if I may be so forthright as to post a direct link, here it is:

    https://sojoe.info/Downloads/jpf_register.zip

    I’d also really like to get the WordPress community’s recommendations on this, too.

    Wow! This is excellent. Works like a charm.

Viewing 15 replies - 1 through 15 (of 80 total)