Query get post,how to add comment box

First of all, welcome to WPSE! By default, the comment box does not come with the post object, what you are looking for is the comments_template function. It should be as simple as changing your code to this: <?php $post_id = 104; $queried_post = get_post($post_id); $content = $queried_post->post_content; $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, … Read more

How to make number of blog posts a custom field?

It might actually still work, but the syntax is currently wrong (you have a PHP opening tag inside another opening tag). And you can assign the value of the custom field to a variable using the get_field function. What if you try this? <?php // assuming your ACF name is ‘number_of_posts’ $numposts = get_field(‘number_of_posts’); $args … Read more

Nothing Found error when creating new posts – how to correct this?

Analysing the Error WordPress database error 42000 : [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near ‘wp_users’. for query SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE ”wp_users” made by display_setup_form, pdo_wpdb->query, pdo_wpdb->_post_query, pdo_wpdb->print_error …reads as: SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE ”wp_users” Your Problem It seems you got constants in your query string. And … Read more

How to load a post into an empty div tag anywhere across the pages?

You can solve this in different ways. One it’s to use simple querys with WP_Query and using the p parameter to retrive a particular post like it’s explained here. Something like this: $the_query = new WP_Query( ‘p=123′ ); while ( $the_query->have_posts() ) : $the_query->the_post(); the_content(); endwhile; Where 123 it’s the post id from where you … Read more

How can I make a post that belongs to a category or have specific tags, display different from the other single posts?

With CSS: If your theme uses post_class() on a containing element, you can target that element with the class .category-songs to control styling. With a template filter: add a filter to single_template and check the assigned categories for your songs category, and use the template songs-single.php if that category is found: function wpse_check_single_categories( $template=”” ){ … Read more