show only one category and filter by tag
This would help you to fetch a single post from a specific category. $args = array(‘post_type’ => ‘post’, ‘posts_per_page’=> 1, ‘cat’ => get_cat_ID(‘Category Name’));
This would help you to fetch a single post from a specific category. $args = array(‘post_type’ => ‘post’, ‘posts_per_page’=> 1, ‘cat’ => get_cat_ID(‘Category Name’));
You need to flush rewrite rules on plugin activation for your custom post type to begin working. register_deactivation_hook( __FILE__, ‘flush_rewrite_rules’ ); register_activation_hook( __FILE__, ‘myplugin_flush_rewrites’ ); function myplugin_flush_rewrites() { // call your CPT registration function here // (it should also be hooked into ‘init’) dwwp_register_post_type(); flush_rewrite_rules(); } You may have noticed it randomly working without having … Read more
Posts page listing pages as well
One option would be to set up a MultiSite. That way each “subsite” is for one event, and when the subsite is created you can programmatically create each Page needed. It just depends on your exact needs whether or not this would be overkill. If you need to have all events linked in some way … Read more
You can use the built-in tag system for something like that. Create a tag for each day of the week, and then tag that post with one of those days. Wherever you display your posts, just check what today’s week day is using the DateTime object and make a query for posts that match that … Read more
Menus are manually managed in WordPress. Log into wp-admin, and there are 2 places you can update these links. Appearance > Menus – select each menu in turn until you find the link in question, then update it. It’s best to add a Page (or Post or whatever content type) straight from this admin interface; … Read more
WordPress generates date archives automatically, it’s just a thing it does. You see the index.php template probably because there isn’t a more specific one for date archives in your current theme. There are plugins that disable these archives, Yoast SEO is one. A quick fix is to empty the date archive rewrite rules: add_filter( ‘date_rewrite_rules’, … Read more
If posts have post_format is gallery, you can get all gallaries by used: get_post_gallery_images(get_the_ID()); See more: https://pippinsplugins.com/retrieving-image-urls-of-galleries/
You can use WP_Query to lists posts with excerpt from specific category. Here is sample code: <?php $args = array( ‘posts_per_page’ => -1, ‘cat’ => 7, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘post_status’ => array(‘publish’, ‘draft’, ‘pending’ ), ‘author’ => 1, ); $postslist = get_posts( $args ); foreach ( $postslist as $post … Read more
After three days of struggling and posting a question here I managed to find an answer. Yeh I know… To my defense I can say that it’s my first WP project. I did it this way: $exclude = get_excluded_parents(); $parents = get_posts( array( ‘post_type’ => ‘jhk_story’, ‘orderby’ => ‘ID’, ‘order’ => ‘ASC’, ‘numberposts’ => -1, … Read more