Forum Replies Created

Viewing 15 replies - 76 through 90 (of 90 total)
  • ghp, see my earlier post… is_tag() is not intended to be used in the way you are looking for, that’s why you’re only getting the “else” response.

    you’ll need to use something like this:

    <?php
    $post_tags = get_the_tags();
    $tag_array = array();
    foreach($post_tags as $tag) {
      $tag_array[] = $tag->name;
    }
    if(in_array('dog',$tag_array) !== FALSE) {
    //show dog tag related code
    } else if(in_array('cat',$tag_array) !== FALSE) {
    //show cat tag related code
    } else if(in_array('pig',$tag_array) !== FALSE) {
    //show pig tag related code
    } else {
    //none of your special tags were found
    }
    ?>

    I haven’t had a chance to test this code as I’ve written it, but that should get you rolling in the right direction. I’ve used this before to show tag-specific opt-in forms to readers on a clients blog…
    I hope this helps!

    -greg

    Hi boa,

    you might try replacing this code:

    <a href="<?php echo get_page_link($pageID);?>" <?php if ($page_id == $pageID || $pageID == $parent_id) echo "class='current'" ?>><?php echo get_the_title($pageID); ?></a>

    with this:

    <a href="<?php echo get_page_link($pageID);?>" <?php if(is_page($pageID)) echo 'class="current"';?>><?php echo get_the_title($pageID); ?></a>

    Hi ghp,

    I think the reason is_tag does not work for you is because that function is intended to detect whether or not the page being viewed is an archive page for a specific tag/all-tags…

    In order to achieve what you’re wanting to do, you’ll need to use the get_the_tags() function and then evaluate whether the desired term is contained in the list of returned tags.

    You might want to write a custom function in your theme’s functions.php file to handle this. Here is the func ref for get_the_tags():
    http://codex.wordpress.org/Function_Reference/get_the_tags

    Forum: Fixing WordPress
    In reply to: Duplicate Posts

    The plugin you’re using WP Page Numbers hasn’t been updated since 2009 and has only been verified to work up to version WP 2.8.

    I would recommend de-activating this plugin in favor of standard pagination or WP Page Navi…

    Other users have reported similar problems with this plugin (unfortunately with no solution)…

    http://wordpress.org/support/topic/wp_page_numbers-plugin-did-not-work?replies=1

    Forum: Fixing WordPress
    In reply to: Duplicate Posts

    I don’t see anything wrong with your code at first glance. Is this being used with a custom post type in a post-type-specific template?

    If so, you can try visiting the permalinks page in your admin, clicking save/update (you don’t need to make any changes) this forces wordpress to look for newly created templates for custom post types and rebuild rewrite and template rules. It seems to me like wordpress might not be using the template you want it to.

    That’s just a guess, though. Good luck! I’ll be watching this thread to see how this turns out.

    – Greg

    try visiting your permalinks page and just click the save/update button without making any changes. This will force wordpress to regenerate/reload your rewrite rules.

    If its still broken, try changing the category base value to something like “topics” and save, and then see if that fixes the problem.

    If it doesn’t, you can delete “topics” and then save to revert back to default “category” base.

    This is a puzzling issue. Perhaps it would help if you posted the contents of your htaccess file when you have pretty permalinks turned on?

    Hi Vinoth,

    I had a quick look at your site. Perhaps you have some plugins running that have something to do with user logins? You might try following the instructions here to temporarily disable all plugins and login:
    http://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F

    If this works, and you are able to login, you can then delete the empty plugins folder you created and rename “plugins.hold” folder. Then you should proceed to your plugins page, open a different browser (i.e. if logged in in firefox, open your login page in chrome while still logged in on Firefox.)

    Using browser 1, deactivate all currently active plugins,
    Then attempt to login in browser 2. If browser 2 logs in successfully, log back out on browser 2, then activate a plugin and repeat the process until you find the offending plugin or successfully re-activate all plugins.

    I hope this makes sense and helps you solve your problem.

    – Greg

    Colin,

    Yikes, bud. That is a problem. 🙁

    If you’re sure you edited WP Core files, you most likely were editing in the wp-includes folder. You could login via ftp and look at the timestamps on the files to see if anything jumps out at you.

    If you’re pretty sure the files you had to customize were in your theme and or plugins though, those will be in the wp-content folder, which you won’t be deleting during the update process. Those files will remain untouched by the upgrade process.

    Hope you figure it out!

    – Greg

    Hi Colin, have you edited any of WordPress’ core files? If not then your manual upgrade should go quite smoothly.

    After you back up your database AND files, the manual upgrade is pretty simple and should not affect any of your wordpress settings unless you have made edits to wordpress core files.

    The manual upgrade basically boils down to these steps:

    1. backup db AND files
    2. De-activate all plugins (I have a lot of plugins on some sites, not all of which are active all the time, so common sense, write down the ones that are active)
    3. Delete the wp-admin and wp-include folders on your server. DO NOT DELETE YOUR WP-CONTENT FOLDER.
    4. Delete all files wp-*.php files in the top level of your wordpress folder EXCEPT wp-config.php.
    5. Upload all wordpress 3.1.2 files to your server except wp-config-sample.php
    6. After upload is completed visit the following url:
    http://YOURWPSITE.COM/wp-admin/upgrade.php
    and follow the steps there.

    And you should be all good to go. I hope! 🙂

    – Greg

    Hi Nathan,

    Here’s a quick and simple way to get the result you want:

    <ul>
     <?php  global $post;
    $cntr = 1;
                     $myposts = get_posts('category=1&numberposts=3&order=des');
                     foreach($myposts as $post) :
                     setup_postdata($post);?>
            <li class="<?php echo "post-" . $cntr; ?>"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></li>
    <?php $cntr++; ?>
                    <?php endforeach; ?>
    </ul>

    What I’ve done here is add a variable: $cntr with a starting value of 1, and echoed that in the class attribute prefixed with “post-“, so the resulting output in the class attribute becomes “post-N”.

    Just above the call to endforeach; you simply increment the counter like so:$cntr++

    Hope that helps! 🙂

    – Greg

    Hi Colin,

    What version were you upgrading from?

    The is_network_admin() function was added in WP v3.1.0, so if you look on your server in the wp-includes/load.php file, you should see around line #614 the definition of this function. If it’s not there, you can probably fix your WP installation by following the instructions here for a manual upgrade: http://codex.wordpress.org/Upgrading_WordPress#Manual_Update

    It seems possible that for some reason, during your upgrade the load.php file is not getting updated with the new file, so you may want to take a backup and then attempt a manual upgrade.

    Hope this helps!

    – Greg

    Hi,

    The first thing I would check is whether or not your current theme has a category.php or archive.php file?

    WordPress theme hierarchy would automatically default to using the main index.php file if your theme does not currently have a template for displaying categories.

    If this is a custom theme, there is a good chance that your index.php file’s loop does not know how to handle category specific requests.

    You can fix this by creating a category.php file if your theme does not currently have a category template.

    Thread Starter datdesignguy

    (@datdesignguy)

    Ok, after some more searching here is the simple answer:

    #1 If you want to use a custom archive page for your custom-post-type, add an additional argument to your register_post_type() arguments:
    'has_archive' => true

    (This will tell WP to look for an archive template according to the codex template hierarchy using the current slug setting of your custom post type. If you want a custom slug for your archives, replace TRUE with the slug name for example: 'has_archive' => 'products' might be the slug you want to use with a ‘product’ post_type.)

    #2 Visit the Settings -> Permalinks page to flush your current rewrite rules and rebuild with the new rules for your custom archive.

    #3 Visit the url to your custom post type archive

    I found a great tutorial for implementing this here:
    http://mark.mcwilliams.me/2010/10/wordpress-3-1-introduces-custom-post-type-archives/

    Good luck!

    Hi Aj,

    I might recommend that you go into your wp-config.php file and temporarily set WP_DEBUG to true, then attempt to access your site with your theme activated. It could perhaps be that you’ve used some code that is stalling out.

    Turning WP_DEBUG on and loading your site will show any php errors, warnings that make for a good place to start troubleshooting your prob 🙂

    Also, if you’re on shared hosting and have the W3C total cache plugin running using APC Cache, that could throw the 500 error. That’s a wild guess, really, but it took me forever to figure out.

    If you have access to your servers log files, you should open the file and see if php is reporting any errors. If its apc related you’ll see something like “unable to allocate memory for pool” or something like that. Can’t remember off the top of my head.

    Hope this gives you a few more ideas. -Greg

    While I haven’t found a solution to this problem yet, I do know that wordpress 2.9.1 seems to have broken post image uploads. Not sure what the deal is with that. Until 2.9.2 though, if you’re an avid image uploader and can’t wait, I’d recommend you roll back your wordpress install to wordpress version 2.9. You can find tons of tutorials on how to do this with a quick google of “downgrade wordpress”

Viewing 15 replies - 76 through 90 (of 90 total)