• On my portfolio Work page, I want to have filters above all my projects that say “All”, “UI/UX”, and “Graphic Design”. When clicking, they would filter out certain projects that are showing. Can someone suggest a FREE plugin for this? I am feeling a little overwhelmed about how to do this.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hi @herussell33 https://wordpress.org/plugins/blog-filter/ may work for what you’re looking for. You can make them categories and sort that way.

    In addition, This is not a plugin but some code that uses a similar function if you choose to go the code route (it should look something like this https://demos.understrap.com/portfolio-child-theme/ you may need to refresh the page) :

    <?php
    /**
     * The main template file.
     *
     * This is the most generic template file in a WordPress theme
     * and one of the two required files for a theme (the other being style.css).
     * It is used to display a page when nothing more specific matches a query.
     * E.g., it puts together the home page when no home.php file exists.
     * Learn more: http://codex.wordpress.org/Template_Hierarchy
     */
    
    // Exit if accessed directly.
    defined("ABSPATH") || exit();
    
    get_header();
    
    $container = get_theme_mod("your_theme_container_type");
    ?>
    
    <div class="<?php echo esc_attr($container); ?>" id="content" tabindex="-1">
    
    	<div class="wrapper" id="index-wrapper">
    
    		<div class="row">
    
    
    			<!-- Do the left sidebar check and open the primary div -->
    			<?php get_template_part("global-templates/left-sidebar-check"); ?>
    
    			<main class="site-main row" id="main">
    
    				<?php if (have_posts()): ?>
    					<?php
         $tax_terms = get_terms([
             "taxonomy" => "category",
             "hide_empty" => false,
             "exclude" => get_cat_ID("uncategorized"),
         ]);
    
         if (is_array($tax_terms) || is_object($tax_terms)) {
             echo "<div class='container'><ul class='nav' id='filters'>";
         }
         echo '<li id="filter--all" class="nav-link filter selected" data-filter="*"><a href="#" class="nav-item">' .
             esc_html("All", "your-theme-textdomain") .
             "</a></li>";
         foreach ($tax_terms as $tax_term) {
             echo '<li class="nav-link filter" data-filter=".' .
                 esc_attr($tax_term->slug) .
                 '"><a href="#" class="nav-item">' .
                 esc_html($tax_term->name) .
                 "</a></li>";
         }
         echo "</ul></div>";
         ?>
    
    					<div class="w-100 p-0 " id="portfolio-grid">
    
    						<?php while (have_posts()):
              the_post(); ?>
    
    							<?php /**
            * Include the Post-Format-specific template for the content.
            * If you want to override this in a child theme, then include a file
            * called content-___.php (where ___ is the Post Format name) and that will be used instead.
            */
           get_template_part("loop-templates/preview", get_post_format()); ?>
    
    						<?php
          endwhile; ?>
    					</div>
    
    				<?php else: ?>
    
    					<?php get_template_part("loop-templates/content", "none"); ?>
    
    				<?php endif; ?>
    
    			</main><!-- #main -->
    
    			<!-- The pagination component -->
    			<?php your_theme_pagination(); ?>
    
    			<!-- Do the right sidebar check -->
    			<?php get_template_part("global-templates/right-sidebar-check"); ?>
    
    		</div><!-- .row -->
    
    	</div><!-- #content -->
    
    </div><!-- #index-wrapper -->
    
    <?php get_footer();
    

    You would need to :

    1. Replace your_theme_container_type with the appropriate container class or ID for your theme.
    2. Replace your-theme-textdomain with the text domain used in your theme for translation purposes.
    3. Replace `your_theme_pagination with your pagination function.

    I hope either the plugin or code helps!

Viewing 1 replies (of 1 total)
  • The topic ‘Portfolio Filters’ is closed to new replies.