How to show posts of a specific category

Change $myposts = get_posts( ‘numberposts=6&offset=$debut’) to $myposts = get_posts( ‘numberposts=6&category_name=home-slider&offset=$debut’) OR $myposts = get_posts( ‘numberposts=6&category=1&offset=$debut’) replace 1 with your category ID Hope this helps

Include plugin´s table in custom query

This was the solution: <?php /** * @package WordPress * @subpackage U-Design */ if (!defined(‘ABSPATH’)) exit; // Exit if accessed directly get_header(); include(‘scripts/search_excerpt/ylsy_search_excerpt.php’); $search = $_GET[‘s’]; $all_users = new WP_User_Query( array( ‘role’ => ‘dc_vendor’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘_vendor_country’, ‘value’ => $search, ‘compare’ => ‘=’ ), ) ) ); //echo … Read more

query posts only works on the first page

As @Pieter Goosen said, you shouldn’t be using query_posts, nor running your own query. Instead, override the main query that already runs: function wpse_144974_pre_get_posts( $wp_query ) { if ( ! is_admin() && $wp_query->is_main_query() && is_home() ) $wp_query->set( ‘cat’, 1 ); } add_action( ‘pre_get_posts’, ‘wpse_144974_pre_get_posts’ );

Add a class to a menu item depending on a body class

Use the nav_menu_css_class() filter. The following function will add the current-menu-item class to a page identified by it’s slug. You can Update the $cpt_name and $menu_item_id variables to reflect your setup. add_filter( ‘nav_menu_css_class’, ‘nav_parent_class’, 10, 2 ); function nav_parent_class( $classes, $item ) { $cpt_name=”team”; $menu_item_id = 127; // id of menu item to add current-menu-item … Read more

How to display search query as formatted text?

You’ll probably want filter out some parameters, change the order they’re displayed, etc – but this should get you started: $s = “/?s=Search&property_city=las-vegas&property_location=Nevada&min_price=20000&max_price=500000&beds=2&baths=3&min_area=1000&max_area=1000000&property_type=apartment&s=Search&apor=Any&apvr=Any&post_type=property”; parse_str($s,$parts); foreach ($parts as $key => $value) { $name = ucwords(str_replace(“_”,” “,$key)); echo “$name: $value<br />\n”; } You can probably just use foreach ($_REQUEST as $key => $value) { unless there’s a … Read more

List of buyers for each product

Goto your wordpress phpmyadmin open database 1.All Woocommerce orders save in table-prefix_posts table 2.and Woocommerce order’s meta info like :billing-addres,customer-name store in table-prefix_postmeta table run SQL command in phpmyadmin SELECT * FROM `table-prefix_postmeta` WHERE `post_id` = any order-id LIMIT 0 , 30 you get list of product meta info. _order_items this meta-key store all product … Read more

query_post or single-[cpt].php?

Try refreshing your permalinks. That is, simply visit your settings -> permalinks page. Then check single-listing.php again. WordPress may need nudging to pay attention to your new file.

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