Articles of posts

Hide thumbnail if there is a gallery on the post

In a post I want to always show one of two options- If the post has nothing but a thumbnail image show the thumbnail. If the post has both the thumbnail and a gallery then show the only gallery and don’t show the thumbnail. I am using a plugin for the gallery called metaslider. but […]

Reset/Reorder posts ID in the MySQL wp_posts table

I have a WordPress site that is considerably popular. I am in the process of optimizing the site before adding other plugins such as the WPML plugin which I suspect will be using custom post types. The site already has other plugins which I don’t suspect use the wp_posts table for custom post types except […]

How to compare post tags?

I want to compare post tags. If the tags match, then display the matching post. For example, I have a post called “ONE” with some tags and another post called “TWO” with some tags. I want to compare both post’s tags and if they match, then display that post.

Bulk update post slugs through database

Is there a way to bulk update permalinks through the database? cause I have like 20k posts and all I want to do is add a prefix to the permalink. I could just manually update but that’s too tiresome for 20k posts. For example if post url is http://example.com/post-1 I want to change it to […]

Get images from the post

Using Add Media I am inserting images in the Post.I want to reterive these only these images on the single post page.I am using get_attached_media function to reterive these images.But it returns an empty array. <?php $media_image = get_attached_media( ‘image’, $post->ID ); //print_r($media_image);?> <div class =”single-post-flex-slider”> <ul class=”slides”> <?php foreach($attachments as $image){ $image_attr = wp_get_attachment_image_src( […]

New posts defaulting to '0' primary key

When trying to create a new blog post, WordPress is showing a Database error: WordPress database error Duplicate entry ‘0’ for key ‘PRIMARY’ for query INSERT INTO `wp_posts` (`post_author`,`post_date`,`post_date_gmt`,`post_content`,`post_content_filtered`,`post_title`,`post_excerpt`,`post_status`,`post_type`,`comment_status`,`ping_status`,`post_password`,`post_name`,`to_ping`,`pinged`,`post_modified`,`post_modified_gmt`,`post_parent`,`menu_order`,`post_mime_type`,`guid`) VALUES (5,’2014-10-13 11:19:21′,’0000-00-00 00:00:00′,”,”,’Auto Draft’,”,’auto-draft’,’post’,’open’,’open’,”,”,”,”,’2014-10-13 11:19:21′,’0000-00-00 00:00:00′,0,0,”,”) made by get_default_post_to_edit, wp_insert_post PHP Warning: Creating default object from empty value in C:\..\..\..\httpdocs\wp-admin\includes\post.php on line 567 I am […]

How do I link a Post Type to a Template in Masterplan?

I’ve made a new .php theme page and want to use that file on one of my Post Types. In the Templates part of Masterpress Ive added my Post Type in the availability section. However, when I view my posts with that Post Type their theme doesn’t change. I cannot see where to select the […]

How to select particular month post from table and update the post status using MySQL?

I would like to change the post status for particular month via MySQL command Using SSH…Can you anyone tell me how to do this via SSH. I have number of post more than 40,000 posts, each month i’m having arround 2000 / 3000 posts, So before going to do the bulk update i have to […]

Different structure/content for posts from a custom post type

I’ve a CPT: Services and created two posts underneath it. Now, both those posts have some static content which is different in structure and design from each other. How do I place that content in my single-services.php so that it gets showed up for the appropriate posts? I have a vague idea of putting the […]

Post/page title to permalink transformation – what is behind the scenes?

If the post name is used as the permalink, what “transformations” does WordPress do to it when using it as the URL and when does it perform these transformations? Like stropping spaces and special characters, etc. Thanks for explaining that process.