Extracting gallery images in WordPress 3.5 on index.php

get_the_content is a template tag and would only work reliably inside a Loop. That means that you should also be able to use the $post global instead. global $post; // may not be necessary unless you have scope issues // for example, this is inside a function $post_content = $post->post_content; preg_match(‘/\[gallery.*ids=.(.*).\]/’, $post_content, $ids); $array_id = … Read more

Pull Random Attachments With Pagination

Your since83_pagination() function is assuming the main query– $wp_query— but you are needing to paginate something very different. You need to be paginating the results in $attachments which you are retrieving with get_children(). That was my guess as soon as I saw this question. You are going to need to rethink this. There are two … Read more

Exclude featured image from attachment loop

Try to use that set of arguments : $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘numberposts’ => -1, ‘post_parent’ => $post->ID, ‘orderby’ => ‘menu_order’, ‘order’ => ‘asc’, ‘post__not_in’ => array( $thumb_id ) ); I’m using it for one of my site and it’s working fine. So you shouldn’t have to use : if … Read more

Some images not found 404 in localhost

Changing the home and siteurl in your wp_options table is not enough unfortunately. You will still have your post content with your non-localhost URL (http://domain.com) causing your website to not display properly on your localhost. Once you’ve downloaded and imported your database to your localhost. Follow these steps: Go and download Interconnect IT’s Database Search … Read more