<?php
// change category to your custom page slug
$categories = get_categories( array( 'include' => array(1, 2, 3) ) );
foreach ($categories as $category) {
$option .= '<option value="'.get_option('home').'/category/'.$category->slug.'">';
$option .= $category->cat_name;
$option .= ' ('.$category->category_count.')';
$option .= '</option>';
}
echo $option;
?>
array(1, 2, 3) is category ids.
Related Posts:
- get taxonomy thumbnail and use it as a variable in code
- How to change logo by category
- go to home page when i select default in select-box
- Show subcategory name selected in specific category woocoommerce
- admin-ajax.php responding with 0
- Using wp_localize_script to store the template url into a variable to use in JS
- How can the plugin directory path be returned into ?
- Get posts with at least one category in common with current post?
- How to exclude specific category from the get_the_category(); array
- Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
- How can I add tinymce editor in WordPress with jQuery?
- How to speed up admin-ajax.php in wordpress
- JQuery not working on WordPress Admin page [closed]
- Customizer Show/Hide
- Page Reloads Before AJAX Request Finishes
- Woocommerce – remove product from category
- Get category name from custom loop and echo it once
- Display all categories including sub categories
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- How to make custom total price reactive in navigation
- Adding tawk.to code just before body tag on functions.php file
- How do I fetch all comments per post via WP REST API?
- Deregistering a script in WordPress seems impossible
- Slide in Panel WordPress Post
- Sending jsPDF documents to the server
- How to prevent those PHP variables from being cached on WordPress?
- Ajax return code 400
- How can I add an alert (like the old javascript alerts) to my WP page?
- Pass PHP variable to JavaScript without inline JS
- Custom category code not showing all posts
- Show post in slider
- How can I output a php value into a JS file within WordPress?
- Using shipped version of jquery
- Putting PHP variables into javascript [duplicate]
- Category Thumbnail Display – How to display ONLY the main Category
- Where do posts get the sidebar from?
- Bridging TinyMCE js and WordPress PHP?
- Trying to implement Ajax comments in WordPress, getting WP error
- How to test nonce with AJAX – Plugin development
- How do I display a user’s previous orders as a select box option on a product?
- Simple Plugin with custom javascript wont work – no console error
- How does this WordPress Plugin (Thrive Comments) apply their custom comment sort? [closed]
- How can I use a modal window to display the current post in loops featured image?
- js file in root loading without
- hover image appears below placeholder instead of overlayed
- combine Code 1 with Code 2
- get current product name in functions.php
- class click counter save number
- Trigger popup in a php if/else statement
- get post based on category chosen in drop down – The ajax method
- How to use transient in this code for related post?
- Slider loading issue
- AJAX request status 200 but no actual “response”
- Button not refreshing page
- Ajax not working es expected (Returns 0)
- Creating a related post section based on similar categories
- Use menu link or onClick to set a variable
- Swapping wp_dropdown_categories function with wp_category_checklist
- How to select the contents in the text view textrea in wp_editor?
- Creating a Multi-Level Associative Object Using AJAX
- WP functions in .js
- Adding custom directory and PHP files in wordpress
- Proper syntax or method for keeping url in modified isotope / category links
- Ajax – Call to undefined function get_option()
- Filter Select results based on selection
- What is an equivalent of single_cat_title for getting the slug of the category?
- Populate dropdown with Child Pages based on Parent Page chosen
- remove wp floating submenu in wp dashboard
- Issue adding sub category programmatically
- Displaying admin notices inside the block editor from rest_after_insert_{$this->post_type} hook
- search and replace preword from author
- How to prevent XSS alter custom global javascript object & methods in WordPress
- How to exclude category ID from Looper in WordPress
- How to complete two other input fields, completed the first
- Add a specific part of current category page url to shortcode
- Status 400 for AJAX POST Request with admin-ajax.php
- how do I get a specific post from a post with a subcategory in WP
- How to inject variables into public-facing JS using wp_enqueue_script
- How to pass aa JS variable to PHP?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- WP grandchild categories in nested ul li
- Ajax random number always the same
- Image upload via FormData API and AJAX is not working ($_FILES always empty)
- Grab posts by multiple categories
- Pass Category Name, Description and Photo into variables to pass to jQuery
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- How to show single category archive
- JS file work only in index page
- Move category description below post list in blog
- Need Help Fixing My Iframes [closed]
- How to pick the default selected value in wordpress dropdown?
- wp_enqueue_scripts leads to error
- Javascript file is not working on single.php wordpress [closed]
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Get page that displays all children of taxonomy parent
- How to change redirection route to a php page for making it only accessible by logged-in members?
- Integrating PHP into Javascript to display map markers with Google API – problem with wp_localize
- Save Search System
- dynamic dependent select dropdown
- selected option if current category is the value