How to retrieve an image from a post and display it before excerpt of a post? [duplicate]

if it is the “Featured Image” of your post, you can use: <?php // check if the post has a Post Thumbnail assigned to it. if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?> check: the_post_thumbnail function else if you want to get the first image inside your post, you can use somthing like that: function … Read more

WordPress removing data attributes for scheduled post

Found the answer. I hope this would be useful to others that might have this problem in the future. All you have to do is remove the content_save_pre filter and content_filtered_save_pre this will remove all Kses input form content filters. //temporarily disable remove_filter(‘content_save_pre’, ‘wp_filter_post_kses’); remove_filter(‘content_filtered_save_pre’, ‘wp_filter_post_kses’); wp_update_post($post); //bring it back once you’re done posting add_filter(‘content_save_pre’, … Read more

WordPress Fatal error: Call to undefined get_header() in index.php on line 15 [closed]

Something went wrong with your installation. As commented by @Sumit get_header() is a core function and cannot be undefined. To troubleshoot: Reinstall WordPress and enable WP_DEBUG in wp_config.php: define( ‘WP_DEBUG’, true ); If it is on a live site you might want to use this instead: define( ‘WP_DEBUG_LOG’, true ); define( ‘WP_DEBUG_DISPLAY’, false ); This … Read more

Where is the correct place(s) in twentysixteen’s header.php to add a Google webfont?

You can place it in header.php between starting <head> and closing </head> tags and it should work properly. Or perhaps a better solution would be to enqueue the style in functions.php function google_fonts() { $query_args = array( ‘family’ => ‘Sigmar+One’ ); wp_register_style( ‘google_fonts’, add_query_arg( $query_args, “//fonts.googleapis.com/css” ), array(), null ); } add_action(‘wp_enqueue_scripts’, ‘google_fonts’);

Which php file lists all the post of a category

WordPress uses a hierarchy of templates (see the visual overview) which it checks for presence. In your case when showing a category archive it will check for presence the following files in this order and use the first one it finds: category-$slug.php (In your case probably category-news-events.php) category-$id.php category.php archive.php [paged.php] if paged index.php So … Read more