Add Word Limit to Posts

You can limit is through a filter on the_content For example (in functions.php): add_filter(“the_content”, “Content_Filter_Custom”); function Content_Filter_Custom($content) { // return a subset of it return substr($content, 0, 300); }

WordPress blog or WordPress website

This is a rather clean-cut answer in my opinion, but each to their own and of course there will be varying opinions on this. The WordPress.com blog hosting service offers one major feature that self-hosted installations managed by WordPress newbies don’t have: great security. It’s no secret that a self-hosted WordPress installation can be a … Read more

Category Foreach keeps looping?

<?php $cats = get_categories(‘child_of=”.get_query_var(“cat’)); foreach ($cats as $cat) : $args = array( ‘posts_per_page’ => 3, // max number of post per category ‘category__in’ => array($cat->term_id) ); $my_query = new WP_Query($args); if ($my_query->have_posts()) : echo ‘<h3>’.$cat->name.'</h3>’; while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php /*general loop output; for instance: */ ?> <a href=”https://wordpress.stackexchange.com/questions/42272/<?php the_permalink() ?>”><?php the_title(); ?></a> <br … Read more

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