WP text editor change html markup

WP is removing things like data-slide-to=”0′ because it thinks it’s cleaning up your HTML for you. Whenever you have somewhat custom HTML like this, use a shortcode instead. You happen to be in luck – there’s already a plugin that creates the shortcode for you. If you don’t want to use a plugin, and you … Read more

Showing categories and subcategories with posts

Update: Complete code <ul> <?php $get_parent_cats = array( ‘parent’ => ‘0’ //get top level categories only ); $all_categories = get_categories( $get_parent_cats );//get parent categories foreach( $all_categories as $single_category ){ //for each category, get the ID $catID = $single_category->cat_ID; echo ‘<li><a href=”https://wordpress.stackexchange.com/questions/270176/” . get_category_link( $catID ) . “https://wordpress.stackexchange.com/questions/270176/”>’ . $single_category->name . ‘</a>’; //category name & link … Read more

SQL Command for restoring trashed comments

I would discourage using raw SQL for moving a post to a trash or back, especially since there’s a build in function for it: wp_trash_post( $post_id ); More about the wp_trash_post() function. The opposite is: wp_untrash_post( $post_id ); wp_untrash_post() also untrashes trashed comments. In WP there are functions for many things – for instance you … Read more

How to get a post’s details by shortcode?

All you need to do is to write a shortcode add wrap a function around it: function get_post_details($atts) { // Get the shortcode’s attributes $atts = shortcode_atts( array( ‘post’ => 0, ), $atts, ‘get-post-details’ ); // Fetch the ID from $atts array $id = $atts[‘post’]; // Stop the shortcode if no ID is set if … Read more

Ignore latest two posts

You can use offset to exclude the latest posts. Your arguments can be like: $args = array( ‘posts_per_page’ => 5, ‘offset’ => 2, ‘post__not_in’ => array(827, 809), ‘post_status’=>”publish”, ‘post_type’=>”post”, ‘orderby’=>”post_date”, ‘cat’=>’-1, -8, -9, -7, -6, -5, -4′, ‘paged’=> $paged ); However as you mentioned, it will break the pagination. There is a workaround, as stated … Read more

Crazy Question – Updating Post ID

First off, I have no idea WHY you would want to do this. IDs are unique for a reason. If you change the ID, I can only see it creating more problems than it solves. Can you explain why you want to do this? I’m sure the community could give you an alternate solution. But … Read more