Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/twinkllestar/portfolio-filter/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
A custom WordPress plugin that displays a project grid with AJAX category filtering and a like button, built with PHP and jQuery.
Features
- Custom post type
projectand custom taxonomyproject_category [project_grid]shortcode renders category buttons and project cards- Category filtering via jQuery AJAX, with no page reload
- Like button that stores counts in post meta via AJAX
Tech Stack
PHP, WordPress (hooks, WP_Query, shortcodes), jQuery, AJAX
How It Works
initaction registers the custom post type and taxonomywp_enqueue_scriptsloadsfilter.js;wp_localize_scriptpassesajaxUrland a nonce to it- jQuery sends a POST request to
admin-ajax.php - The PHP callback (
wp_ajax_/wp_ajax_nopriv_) verifies the nonce, sanitizes input, queries withWP_Query, and returns JSON - jQuery replaces the grid HTML with the response; event delegation keeps the like button working after the grid is replaced
Security
- Nonce verification with
check_ajax_referer - Input sanitization with
sanitize_text_fieldandabsint - Post type validation before updating post meta
Installation
- Download this repo as a ZIP, or clone it into
wp-content/plugins/portfolio-filter - Activate Portfolio Filter in the WordPress admin
- Add some Projects and Project Categories
- Put
[project_grid]in any page using a Shortcode block