PHP time function ($today) for GMT +1
Time is one of the things in environment WordPress normalizes to GMT, so all native PHP function give that in WordPress context. To get time in timezone, set in WordPress settings, try date_i18n() instead.
Time is one of the things in environment WordPress normalizes to GMT, so all native PHP function give that in WordPress context. To get time in timezone, set in WordPress settings, try date_i18n() instead.
Before you do your output, do something like this: $no_thumbnails = true; foreach( $shows_sales as $p ) { if( has_post_thumbnail( $p->ID ) ) $no_thumbnails = false; } Then in your loop you can do something like this: <?php if( $no_thumbnails === true ) : ?> <!– Your output here –> <?php endif; ?>
If your style.css is in /wp-content/themes/themedirectory, and your image is at /wp-content/themes/themedirectory/images/image.jpg, then your css will be this: background-image: url(“images/image.jpg”); You can’t use php in a css file, it will not parse unless included via php (instead of with <link>).
Change above code to like this: <?php $cast_members = get_post_meta($post->post_parent, ‘cast_members’, true); ?> <p><?php echo wpautop($cast_members); ?></p> <?php endif; ?> in this code wpautop() function automatically adds p tag for cast members.
Put this into your functions.php file: function userfunc_get_post_views($postID) { global $post_stats; foreach ( $post_stats as $p ) { if ( $p[‘post_id’] == $postID ) { ?> <span class=”stats-post-views”> <?php echo number_format_i18n( $p[‘views’]) . ‘ views’; ?> </span> <?php } } } and then into your single.php file where you want the views to be displayed: … Read more
Turns out the same functionality can be achieved with wp_gdsr_render_article() if you set it to read only
You’re using tax_input incorrectly. You’re not literally supposed to say taxonomy_name, you’re supposed to enter the name of your custom taxonomy. See https://codex.wordpress.org/Function_Reference/wp_insert_post. So, assuming your taxonomy is called ‘ninja_turtles’ and you are tagging your post with ‘donatello’ and ‘michelangelo’: // Create post object $my_post = array( ‘post_title’ => ‘My post’, ‘post_content’ => ‘This is … Read more
post_category expects an array of term IDs, not a string/term slug $news_term = get_term_by(‘name’, ‘news’, ‘category’); $term_id = $news_term->term_id; Now use the terms ID not its slug/name in your query args. ‘post_category’ => array($term_id),
http://wordpress.org/support/topic/get-tags-specific-to-category $category_tags = $wpdb->get_results(” SELECT DISTINCT terms2.term_id as tag_ID, terms2.name as tag_name, t2.count as posts_with_tag FROM $wpdb->posts as p1 LEFT JOIN $wpdb->term_relationships as r1 ON p1.ID = r1.object_ID LEFT JOIN $wpdb->term_taxonomy as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id LEFT JOIN $wpdb->terms as terms1 ON t1.term_id = terms1.term_id, $wpdb->posts as p2 LEFT JOIN $wpdb->term_relationships as r2 ON … Read more
You can do that by running this SQL query: UPDATE `wp_posts` SET `post_password` = ” WHERE `post_type` = ‘post’; Change wp_posts to match your own posts table name.