Getting the ID of any image for use in functions.php

Hopefully this helps, function mat_image_credit() { global $post; $args = array( ‘post_type’ => ‘attachment’, ‘post_parent’ => $post->ID, ‘post_mime_type’ => ‘image’, ‘numberposts’ => -1, ); $imgs = get_posts($args); foreach ($imgs as $img) { $field1 = slt_cf_field_value(‘flickr_credit’, ‘attachment’, $img->ID); $field2 = slt_cf_field_value(‘custom_credit’, ‘attachment’, $img->ID); if (!empty ( $field1 ) ) { echo ‘Image by ‘ . $field1; … Read more

404 on pagination but with a strange twist (error 404 only when there is single post on the second page)

While comment is absolutely correct about what you should be doing, I want to elaborate a bit why exactly query_posts() is recipe for horribly broken pagination. Main WordPress query runs before execution reaches template file, which is actually chosen depending on results of it. When query runs for archives it takes global settings of post … Read more

Converting the_content string to an array?

Filter ‘img_caption_shortcode’. You get three arguments: an empty string, the attributes (including the attachment id), and the caption content. If you return anything but an empty string WordPress will print your return value instead of its own code. See wp-includes/media.php for details. Another option: hijack the caption handlers and create your own output or change … Read more

Advanced Taxonomy Queries WordPress

This is not a complete answer, but I hope this can help. It sounds like what you’re looking for is a “Faceted” navigation (or search or browsing) plugin. There are some plugins that do this already, like this one (from the FCC!). It’s possible that none of the existing plugins will match your needs, but … Read more

Creating a nav menu

First, be sure your theme supports wp_nav_menu which is goes into a template file – such as header.php – with the template tag function <?php wp_nav_menu( $args ); ?> which also requires a function in functions.php. See http://codex.wordpress.org/Function_Reference/wp_nav_menu That will initiate the WordPress 3 menu system that will appear in Dashboard>>Appearance>>Menus Next, read http://codex.wordpress.org/WordPress_Menu_User_Guide on … Read more

How to redirect to correct pages after permalink structure change

WordPress should handle all redirections correctly, without you needing to worry about them. For example, if your old post was http://example.com/2012/10/11/i-like-stackexchange any links should auto-magically be redirected to http://example.com/favorite-things/i-like-stackexchange. I just tested it on a site with WordPress 3.4 installed, and it worked just fine. WordPress can read your mind.