<?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
- Display current category title on category page
- Inject post (from specific category) between posts in Loop
- Add a class to links in the visual editor (how to get old dialog back)
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- Calling a method from functions.php on a click of a button
- Get post meta in enqueued js file
- Allow authors to post only in categories they create in WordPress
- How to use WordPress (PHP) functions in AngularJS partials files?
- How to create a custom config file and get data using inline JS in a wordpress page
- List all categories but exclude current post category on single post page
- Custom WordPress+PHP+MYSQL+AJAX form, submit event not captured by Javascript, but does POST data to the DB
- Edit category output
- Archive dropdown styling not applied
- using woocommerce_template_single_add_to_cart in shop-loop – javascript issues [closed]
- Use WordPress’s Media Uploader/ Manager in non WordPress php application
- Get/Set wp.customize.previewer.previewUrl
- Different background-image by category
- How to speed up admin-ajax.php in wordpress
- How to make custom total price reactive in navigation
- Adding tawk.to code just before body tag on functions.php file
- How can I output a php value into a JS file within WordPress?
- Putting PHP variables into javascript [duplicate]
- How to test nonce with AJAX – Plugin development
- hover image appears below placeholder instead of overlayed
- get current product name in functions.php
- Slider loading issue
- Creating a Multi-Level Associative Object Using AJAX
- remove wp floating submenu in wp dashboard
- search and replace preword from author
- How to exclude category ID from Looper in WordPress
- How to complete two other input fields, completed the first
- how do I get a specific post from a post with a subcategory in WP
- WP grandchild categories in nested ul li
- Need Help Fixing My Iframes [closed]
- wp_enqueue_scripts leads to error
- Get page that displays all children of taxonomy parent
- Passing UTM Parameters To Modify Page In WordPress
- Open post-content in archive page in a Modal box with bootstrap
- Creating own shortcode – echoeing php variable based on JS variable
- How to add a do_action on refreshing of WP customizer?
- PhantomJS with wordpress
- Add / Update Custom Fields After Select Pictures in Media Window
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Dilemma of Populating all the categories in a drop down list
- JSON REST API WordPress only showing first 10 categories
- Tell WP register script to load a script only when the entire page is loaded
- Get all categories post is not in
- How do I get an external php page to load using javascript
- wordpress admin plugin menu custom css
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- trying to put an active hover to my custom nav category buttons [closed]
- In WordPress, how do I get the number of posts next to single_cat_title(”); in the category.php file?
- How do I get my Javascript scripts working?
- Why i can’t get custom fields value or post ID via Ajax?
- Post not populating for custom post type based on category selection
- get db values for external js file
- Removing sidebar on category pages
- Calling PHP Titles inside Javascript Markup
- Ajaxurl suddenly not defined
- ‘Bones’ theme: Load stock scripts in footer instead of header?
- Replacing WordPress Icons (menu,icons32, etc)?
- How to redirect non logged in mobile users to page on same site?
- Wrong Number of Products When Hiding Subcategory Products From Showing In Parent Category
- Creating a brand attribute as a variable
- Decode and Decrypt Azure B2C OpenID Authorization Token, Use Response in API Call (Example Token Within)
- How do I edit the terms output args or array data?
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- Display Visual Composer shortcode if a post belongs in specific categories
- Add other class content with reference class value
- Exclude ipads and tablets form wp_is_mobile code
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- Hide a specific category title from displaying on site
- Pulling Products from an API
- Return to the beginning of the results of a for loop
- Filtering markers on google map by WordPress category[SOLVED]
- Call jQuery function from PHP?
- How to call a function from functions.php with ajax?
- Populate Posts based on category selected using AJAX that means without page refresh
- random woocommerce categories are not showing when count enabled?
- How to Retrieve All Category Images on Front-End
- Full search and replace isn’t enough to make all pictures to be loaded with https
- scroll scrpit to particular button position to next id when click button
- Find the method which AJAX GET calls
- Why this plugin is not working?
- Is there a way to randomize and connect a background and header image?
- Trying to fix multiple category drop down
- wp_get_archive for category returning different URLs on different but similar sites
- dynamically filter by category via sub-menu
- Get unique post in parent category
- Incomplete term slugs output from a foreach loop with get_the_terms
- Facebook share button only share the_permalink(), without thumbnail, tilte, excerpt, etc
- get_option(‘admin_email’) not working in wordpress when using ajax call
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- Disable Typed Parameters for JavaScript in PhpStorm? [closed]
- Losing Session ID and sessionStorage when navigating to other domains on Multisite
- How can I use AJAX in child theme template?