Why aren’t paragraphs breaking on this page?

get_the_content() returns unfiltered content, and using a shortcode you cannot use the_content() to return filtered content as you cannot echo inside a shortcode. Your best option here will be is to applying the_content filters to get_the_content(), something like: apply_filters( ‘the_content’, get_the_content() ); EDIT Exact usage, replace $output .= get_the_content(); with $output .= apply_filters( ‘the_content’, get_the_content() … Read more

Display recent posts on another site

I’m not sure what you’re doing with the above script, but here are some random suggestions: Avoid using the root user, for security reasons create another database user with less powers. Avoid using deprecated mysql_* calls. Use WP_Query() or get_posts() instead of hardcoded SQL queries. Use global $wpdb object if you really must use hardcoded … Read more

List recent posts with link to first category

get_category_link() accept the category ID or object and you are passing the post ID. the_category() accept Separator as a first parameter to separate multiple categories and again you are passing post ID. You can use get_the_category to get all the categories and then display one of category information. Example:- $all_post_categories = get_the_category($recent[“ID”]); $category_obj = isset($all_post_categories[0]) … Read more

Exclude latest post from WP_Query taxonomy term loop

wp_query has the offset parameter which you can use to skip posts, e.g. $args = array( ‘post_type’ => ‘video’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘tax-video’, ‘field’ => ‘slug’, ‘terms’ => ‘t-o-t-w’, ), ), ‘posts_per_page’ => ‘8’, ‘offset’ => 1, // excludes the first post in the query ); you may just be over thinking … Read more

Sort / display recent posts by publish date

The Recent Posts widget, and the posts page for that matter, doesn’t display ordered by update date, it orders by published date. If it’s displaying by updated date then you must have a plugin somewhere that’s changing this behaviour, or are using something other than the standard Recent Posts widget.

2 column recent post query not respecting float right [closed]

Try this <div class=”row”> <?php $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 3 ); $counter = 0; $_posts = new WP_Query($args); ?> <?php if( $_posts->have_posts() ) : ?> <?php while ( $_posts->have_posts() ) : $_posts->the_post(); $counter++ ?> <?php if ( $counter === 0 || $counter === 1) : ?> <div class=”col-md-6 float-left”> <div> <a … Read more

widget_posts_args not using the number of posts in widget

The problem is that you’re not modifying the existing arguments for the widget, you’re replacing them: add_filter(‘widget_posts_args’, function() { $params[‘post_type’] = array(‘post’, ‘recipe’); return $params; }); The result of that filter will be: $params = [ ‘post_type’ => [ ‘post’, ‘recipe’ ] ]; So any other arguments, including the default number of posts, are removed. … Read more

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