Exclude category and post from loop in custom category.php

Here is a correct way: <div id=”category__product-grid” class=”row”> <?php query_posts( array( ‘cat’ => array(6,-45), ‘post__not_in’ => array(-598), ‘orderby’ => ‘title’, ‘order’ => ‘ASC’ ) ); ?> <?php // The Loop while ( have_posts() ) : the_post(); ?> <div class=”col-md-4 col-product-item”> <a href=”https://wordpress.stackexchange.com/questions/321415/<?php the_permalink() ?>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><div class=”cat__featured-img”><?php the_post_thumbnail(); ?></div></a> <h2><a href=”https://wordpress.stackexchange.com/questions/321415/<?php the_permalink() ?>” … Read more

WordPress Recent Posts – Loop

Add this function in your functions.php for specific size of thumbnail add_image_size( ‘custom-size’, 220, 180 ); and fetch custom-size image. For excerpt length use this function. function wp_example_excerpt_length( $length ) { return 30; } add_filter( ‘excerpt_length’, ‘wp_example_excerpt_length’);

Hide a category/posts from the homepage in wp

Have you tried Ultimate Category Excluder plugin? You can use it to exclude categories very easily. You just need to select the categories that you want to remove. It can be very useful, as you are not comfortable with coding. Also, you can try using the following codes: function exclude_category_home( $query ) {if ( $query->is_home … Read more

my ajax wont sent the data, please correct my code

function kategori(){ //alert(kategori2); jQuery.ajax({ url: MyAjax.ajax_url, type: “POST”, data: { action: “berubah”, kategori: “berita” }, success : function(response) { console.log(response); //Acess whatever you sent from the back-end with response.data.%var_name% }, error: function(data ) { console.log(response); } }); } function berubah() { $kategori = $_POST[‘kategori’]; wp_send_json_success( $kategori, 200 ); } Use wp_send_json_success. Response I got: {“success”:true,”data”:”berita”}