Codeless
  • Support Home
  • Themes
  • Support
  • WordPress Tutorials
    • How to Start a Blog
    • Best Website Builders
    • Best Small Business Hosting
    • Email Marketing Services
    • Cheap WordPress Hosting
  • Video Tutorials

Community Forums

Exclude categories from the Full Blog widget?

blogCategoriesexcludespecular
    • 7 years, 8 months ago vmg-developer
      Participant

      Expired

      I’d like to exclude posts with a certain category from showing in the roll on the Full Blog widget. How can I do this?

    • 7 years, 8 months ago Mirela
      Participant

      Hello,

      Are you referring to the “Latest posts” widget? Or the “Full Blog” element of Visual Composer? It is not possible filtering based on category in the first one. In the second, you can chose a category (go to Full Blog Settings > Set Headlines From Blog) but not exclude one.

      Best regards!

    • 7 years, 8 months ago vmg-developer
      Participant

      Expired

      Thanks for the reply.

       

      I was actually looking to exclude certain categories from the Full Blog element of visual composer. I have 20 categories of posts, but I only want 19 to display.

      I figured out how to this in code, however. I ported over /specular/vc_templates/home_blog.php to my child theme and then edited this line:

       

            if($dynamic_from_where == 'all_cat')
                query_posts('posts_per_page='.(int)$posts_per_page.'&paged='.get_query_var( 'paged' ) ); 
              else
                query_posts('posts_per_page='.(int)$posts_per_page.'&cat='.$dynamic_cat.'&paged='.get_query_var( 'paged' ) );
              
      
      

      And you change it to this:

      
            if($dynamic_from_where == 'all_cat')
                query_posts( array( 'posts_per_page='.(int)$posts_per_page.'&paged='.get_query_var( 'paged' ), 'cat'=>'-244' ) ); 
              else
                query_posts('posts_per_page='.(int)$posts_per_page.'&cat='.$dynamic_cat.'&paged='.get_query_var( 'paged' ) );
              
      

      ‘244’ is the category ID of the category you’re looking to exclude.

    • 7 years, 8 months ago Mirela
      Participant

      Hello,

      I am glad you found your solution. Thank you for sharing the edit.

      Best regards!

Viewing 3 reply threads

You must be logged in to reply to this topic.

Login

Log In
Register

Renew Support

  • Renew Specular Support
  • Renew Tower Support
  • Renew Folie Support
  • Renew Handel Support
  • Renew June Support
  • Renew Picante Support
  • Renew Thype Support
  • Renew Regn Support

Search Forums

Forums

  • Bygge – Construction Theme
  • Converta – Software Theme
  • Folie – The WordPress Website Builder
  • Handel – Responsive Multi-Purpose Business Theme
  • June WooCommerce WordPress Theme
  • Livecast – Podcast Theme
  • Picante – Restaurant & Food WordPress Theme
  • Regn | Agency & Business WordPress Theme
  • Remake – Minimal Portfolio & Agency Theme
  • Specular – Multi-Purpose WordPress Theme
  • Suggest us Features
  • Tower – Business-Driven Multipurpose WP Theme
  • Vibrance – Photography Theme

Site Links

  • Support Policy
  • Specular Support Forum
  • Video Tutorials
  • Knowledge Base
  • Guides and Reviews

Useful Articles

  • Build a Website
  • Web Design & Development
  • Hosting
  • WordPress

Login

Log In
Register Lost Password