Drupal codes

Notes about Web design and front-end development :)

Pages

  • Tutorials
  • About me
  • Donations
  • React.js
  • Refund Policy

Friday, June 8, 2018

How to query posts using taxonomy filters

h1. Show all posts that belong to taxonomy "KC Slider", with the term "Show in slider" In your loop template, please use the following format (see comments for details):
 
 'post',
 'tax_query' => array(
  array(
   'taxonomy' => 'kc_slider',
   'field' => 'slug',
   'terms'    => 'show-in-slider',
  ),
 ),
); ?>


 have_posts() ) : //get the filtered posts ?>
 have_posts() ) : $query->the_post(); ?>
   

Posted by Rafael Arevalo at 10:02 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Contact Me

Name

Email *

Message *

Search

Most popular

  • Error: ReCAPTCHA placeholder element must be an element or id
    Couldn't find an answer to this simple error anywhere. This error means that the recaptcha api function couldn't find the referenc...
  • Drupal 8 (twig): If node id equals x, do something (example)
    How to create an if conditional statement based on node id? For Drupal 8, you use the variable "node.id" (using Twig) {% if n...
  • CKeditor for Drupal 7: add custom fonts
    1-Disabled Media WYSIWYG View Mode and WYSIWYG modules 2-Downloaded CK Editor drupal module: https://www.drupal.org/project/ckeditor 3-Ins...
  • Pear installation + CodeSniffer + Drupal CS for WAMP 2.2
    Pear installation: 1-Download PEAR installer from http://pear.php.net/manual/en/installation.getting.php 2-Copy/Paste this file in your PHP ...
  • How to add Isotope Fx to blog page
    STEP 1: Add isotope fx script file Associate isotope.min.js file in your theme's functions.php file: wp_enqueue_script( 'isotope...
  • GIT remove file from list of modified files (for beginners / noobs)
    How to keep local files unchanged/untracked? git update-index --assume-unchanged name-of-file.extension and it’s counterpart: git update-ind...
  • Javascript: Get object from clicked element
      function getObjectFromClickedEl ( clickedElClassName ) {       const clickedEl = document . querySelectorAll ( clickedElClassName );  ...
  • Photoshop: multiple pages for print materials in PDF format
    To create multiple pages, you’ll need to create multiple artboards. To do this, please check the “artboards” checkbox when creating your doc...
  • Figma not ready yet for printable documents
     Although there are plugins that let u export into CMYK printable PDFs, Figma will not let you modify its colors. Also, as to date, CMYK mo...
  • How to add a modal form in Drupal 7
    Here's how to do it if using the colorbox module fails... 1- Create your form using Webforms (or use the method you prefer) 2- Optio...

Followers

About Me

My photo
Rafael Arevalo
View my complete profile
Awesome Inc. theme. Powered by Blogger.