show recent posts php code error?

Looks like you have the Posts for Page plugin installed. I don’t know where you have put that code you mention, but the page is generated by the shortcode, which says that output should be limited to the beauty category. You probably don’t need to write code yourself. Read the manual of the plugin and … Read more

How I can made a custom post type to page templates?

You need to add: ‘supports’ => array(‘title’, ‘editor’,’page-attributes’,’thumbnail’) add this to your array after ‘singular name’ => ‘pictures’. The thumbnail adds the featured image option to your post type. You can access the post type archive: yoursite/archive-pictures, this will use your themes archive.php file if it exists. Or you can create a custom post type … Read more

How to get post with slug and exclude categories

Please read this Codex page why you should not use query_posts(). If you really want to use query_posts(): query_posts( ‘name’ => ‘test’, ‘category’ => ‘-15’ // notice “minus 15” ); The right way to exclude category: $query = new WP_Query( array( ‘name’ => ‘test’, ‘category__not_in’ => array(15) ) ); if ( $query->have_posts() ) { ….. … Read more

Post Title to featured Image ALT

If $size is already an array in your original code as it looks to be, then the argument passed will become array(array(150,150)) instead of just array(150,150) and fail, so you can just do: <?php $title=get_the_title(); the_post_thumbnail( $size, array( ‘alt’ =>$title) ); ?>

Need help removing […] after excerpt

This has to work, Im using it in several projects: add_filter( ‘excerpt_more’, ‘my_excerpt_more’ ); function my_excerpt_more( $more ) { return ”; } Just copy-paste it to your functions.php. Little bonus snippet that you might need: add_filter( ‘excerpt_length’, ‘my_excerpt_length’ ); function my_excerpt_length( $length ) { return 50; } This means that excerpt is 50 words long. … Read more

Update if post with specific title exists

First, I would use WP_Query instead of the manual DB query (and don’t tell me that’s because of performance because you’re querying 2 times the same thing). Second, you’re saving your post as draft status and querying post with status publish

WordPress display posts category in loop

The below code check that post have category or not. If post have category then it will display list of category separate by comma. You can try this code. Hope this will help you. if(has_category()) { echo $cats_list = get_the_category_list(‘, ‘); }