Three different post types on homepage

Since you’re not displaying a different amount of posts on the front page and on the paged pages for your main query, you don’t really need to mess around with the offset. All you need is to exclude the three posts you’ve already shown from your query, which you can do with the pre_get_posts action: … Read more

XMLRPC and Underscored custom fields

Playing with XML-RPC and underscored custom fields: Let’s say we want to set the featured image to a given post with $remote_post_id. We want it to be the attachment with ID equal to 300, so we want _thumbnail_id to be 300. Here are three methods how one could achieve that: Method #1 – Using post_thumbnail … Read more

How to get featured post title & image using JSON API?

I made a shortcut to my image by adding it directly to the API response. //Add in functions.php, this hook is for my ‘regions’ post type add_action( ‘rest_api_init’, ‘create_api_posts_meta_field’ ); function create_api_posts_meta_field() { register_rest_field( ‘regions’, ‘group’, array( ‘get_callback’ => ‘get_post_meta_for_api’, ‘schema’ => null, ) ); } //Use the post ID to query the image and … Read more

How to display Section for certain time

Check the time parameter on WP_Query Class. There is a example on how to show posts form last 30 days. You can do it for last couple of hours, minutes or even seconds! Code is tested and working. $args = array( ‘posts_per_page’ => 1, // We are showing only one post ‘category_name’ => ‘prime’ // … Read more

Is “Featured Content” in Twenty Fourteen done with a plugin, or is it native in WP4.0?

The featured content is part of the TwentyFourteen theme, and is not implemented as a plugin, but rather as an Appearance > Customize setting (via get_theme_mod()), which allows the use of a Grid or Slider layout, choosing posts base on the tag provided. BTW, I figured this out only after reading your post! So thanks … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)