if ( $query->have_posts() ) : ?>
<ul id="list-con">
<?php
while ($query->have_posts()) :
$query->the_post();
?>
<?php
switch ( get_post_type( $post->ID ) ) {
case "firstcase":
?>
<li>code as defined above</li>
<?php
break;
case "secondcase":
?>
<li>another code as defined above</li>
<?php
break;
}
?>
<?php
endwhile;
?>
</ul>
<?php endif;
Related Posts:
- Check if a menu is empty?
- Use template for posts with a particular category grandparent
- Add a Second Menu to a theme that only support 1 menu
- Custom excerpt function re-factoring
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- Use WordPress function in php file
- Adding wrapper elements in the_date() like in the_title()?
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Create page template via functions.php?
- add_filter function concatenate string and locate_template function
- Splitting the_content() by size?
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- Display metabox galleries on specific page template in admin editor
- How to include a function in a template with template tag
- php “use” not working in template [closed]
- Loop on a wordpress Page instead of content coming from the WP text editor
- How does printf( __( ) ); work?
- Return HTML Template Page with PHP Function
- Error Warning: Declaration of description_walker::start_el after PHP upgrade [duplicate]
- Displaying Logged-In User Name in WordPress Menu
- Set media upload attachment link to none and hide it in WP v3.5
- Fatal error: Call to undefined function plugin_dir_path()
- Switching wp_get_sites to get_sites
- One button to change all settings in theme customizer?
- Add custom image sizes to media uploader
- On this day PHP code
- How to add default images into theme customizer image control?
- Is $hook a global variable in WordPress
- Successful or Error Message after running mysql code in functions.php
- How can one utilize a variable as a callback function name for add_settings_field
- Custom Logo URL | Help me print the URL of the custom logo I inserted into my theme
- Link to file in plugin directory from wordpress template?
- Using a switch statement in WordPress
- Include a php file from functions.php only to homepage
- Shortcode content output but not in correct place
- How to restrict page access to logged-in users?
- Count the number of times the search form template gets included on a page
- Handling Body class based on Template
- Adding Default Settings to Theme My Login plugin
- Mass update excerpt
- Automatically adding new post categories to menu
- Get post id in a function when edit/add a post
- function to assign user role based on a field from usermeta
- get author_name from queried post
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- WordPress Gravatar filter is removing my custom attributes
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- Remove echo from shortcode
- Copyright info change – Corporate Plus Theme PHP [closed]
- Inject class in body when particular page template is used
- How to list posts from a plugin taxonomy?
- Filtering a function’ output for a new continued function
- Shortcode to find and replace URL
- Deleting Certain terms from appearing on the front end as links
- first instantiated SimplePie object cosumes 5mb?
- Theme not calling Jquery properly
- How to set a template with wp_insert_post
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- WordPress redirect redirecting too many times or not at all
- Add value to new attribute inside WordPress menu items
- Please show me how to use an if/else statement in combination with wp_enqueue
- If Array Values Match Another Array’s Values, Then
- Custom query vars filters problem with pagination
- Automatically Add Page Links to Nav Menu
- Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS
- Must filter functions receive all arguments passed to them?
- How to Display a List of Child Pages For a Parent Page in WordPress
- Displaying Slider in Front Page (home) using Customizr Theme
- How to add PHP pagination to wordpress
- Is there a way to create a “copy post” link?
- Taxonomy term description with style, only if the description exists?
- Restrict post to current user in postmeta
- How to change the author box selection on a post to a custom taxonomy
- How to send a php var to jQuery Ajax call with two different file
- copy fields value to another field
- not outputting medium size image URL
- posts_per_page displays only 2 posts instead of 4 posts
- Get parent category name when only child category is applied to a product
- Can an AJAX callback function access a PHP variable which was defined during initial page load?
- Adding product permalink on admin order page throwing error
- Before & After Content – After Content directly below Before Content when using require_once
- How to create dynamic templates?
- Change WooCommerce template for PDF – access to custom field
- How to call WordPress PHP file using external js file
- How fix error in the WordPress loop?
- use system script advertising in wordpress multisite
- Use WP_Query Data In Cookie
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- Insert wordpress tags below posts via functions.php
- Help with my first Metabox helper class
- ISOTOPE – Missing/Invalid Arguement Get Terms
- Showing all post from all post type in admin backstage
- Pagination not displaying
- Load a Header in wordpress
- Trouble figuring out how to get my button to submit comment
- Setting WooCommerce currency programmatically
- Masking external links with internal link for member-only
- Shortcode to include PHP file, pass various parameters to include?
- How to limit the number of posts in the wordpress loop in conjunction with the “download more” button?