Often you’d want to have more than one statement to be executed conditionally. Of course, there’s no need to wrap each statement with an if clause. Instead, you can group several statements into a statement group.
So You have to use curly braces
{}
to add more statement within if
else
<?php if ( $paged < 2 ) {
echo 'some text';
?>
<p>
Text...
<?php $published_posts = wp_count_posts('item');
echo $published_posts->publish; ?>
text...
<?php echo do_shortcode("[count]"); ?>
text.
</p>
<?php
} else {
echo 'some other text';
} ?>
Related Posts:
- Conditional Statement – check if post has an attachment image
- Trying to use Ternary operators with WP Conditionals
- How to do conditional publishing?
- conditional statement for custom taxonomy
- Add user settings to specific roles
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Create a new usermeta field for users
- Redirect to a different page through registration, depending on page
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- What is the correct way to write this conditional statement?
- Reordering Buddy Press profile navigation [closed]
- Is_front_page inside header.php is always returning true
- Advanced Custom Fields – display label and value only if value entered
- PHP conditional script issue
- How to check if the current page is at a specified path in the URL?
- Add class to DIV depending on page loaded
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Multidimensional Array
- Conditional featured image with youtube thumbnail
- How to make a conditional statement within $output in shortcodes.php?
- Conditionally remove comments and post meta in functions.php
- exclude custom post type from running a function
- include content within conditional statement?
- Show label for value only when value exists, basic php
- Conditional formatting on data fetched from MYSQL
- Find and print first entry from WordPress post in custom excerpt?
- Adding if statement
- Change Login or Logout text based on status
- Jetpack: Display Site Title when no Site Logo
- If else statement based on referral URL
- If Month=Particular month display content [closed]
- Php conditional help needed
- Custom Meta Box If Else Statement
- Hide a nav menu item based on get_user_meta results
- Not able to see the error [closed]
- What do ++ and *+ mean?
- How to add date range in woocommerce with code
- How can I modify the permalink via a filter?
- How can merge two arrays values in one array and save in database
- Is it possible to generate a page without create in the admin?
- Admin Media grid view images won’t load
- WordPress remove EXIF Data from specific Thumb
- Create a post variable processing page
- How to redirect all 404 in a WordPress subdirectory to the index.php of subdirectory?
- How Do I Add User Custom Field to REST API Response?
- Bare minimum to include in PHP file to use WP functions? [duplicate]
- Should I store my Facebook access tokens?
- How to return output of the new wp gallery block for automatically Link images To Media file
- Can an array be used as a meta_query value?
- When must I use and verify nonce?
- Filter get_the_title to remove certain characters?
- Displaying a button on each post
- Store records for a table in wordpress
- Slider loading issue
- WooCommerce Related Products by Attribute
- Image as Sales Badge
- Sort posts by custom fields value using dropdown menu
- Cause of Blank Lines Being Added to WP FIles?
- Limit Widgets to Sidebar ID’s
- How to improve my WordPress filter to include empty custom fields
- Weird 404 URL Problem – domain name being placed at end of urls
- Trouble checking if custom woocommerce checkout field is empty or not
- Add / Update Custom Fields After Select Pictures in Media Window
- How to debug this search & replace strings snippet?
- Can’t retrieve element with WordPress default @fetch_rss();
- I have a snippet to redirect all users to a maintenance page. How do I exclude users with admin role?
- Where can I find the inline-css of my theme header?
- Remove empty terms from array, sort alphabetically, update back to repeating field
- Call WC_Product get_price()?
- How to remove the space before the ellipsis in excerpt?
- Website completely messes up when logging out
- How do I include an external PHP file in a subdir WordPress install?
- page 1 is not paged
- How do I call an external php non WordPress class into functions.php?
- Drupal is going Symfony. Would WordPress benefit from doing the same? [closed]
- no_rest_route error on custom routes
- HTML Form Question
- Exclude ipads and tablets form wp_is_mobile code
- How to put the day of the function get_the_modified_date (‘l’, $post_id’) with the first capital letter?
- WordPress How do I pass a variable from one add_action to another?
- Advance custom fields variable with if statement & Function
- Set a cookie inside the 404.php theme page
- Printing OEmbed URL based on Post selected w/o page refresh
- How to use something like meta_query but for fields?
- Local WordPress from Git repo, where to set document root?
- Sort WooCommerce data with WP-CRON?
- Array sorting assistance
- Apply filters when loading post via ajax
- Shortcode At top of Page – PHP 5.5 vs 5.4 – ob_start();
- Page downloads as file in Chrome
- Redirect users not logged in to the standard login page (and back) from some posts and pages
- wc_add_notice not working on cart page
- How to convert my comment.html to comment.php
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- Woocommerce – Shipping tax class based on cart items not using the highest tax available
- It’s not showing full content for posts pages in wordpress “[…]” while customing some changes in the style.css file [closed]
- How do I convert a custom field to a php date format? [closed]
- append special url end of my website urls
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- links Slick jS library using wp_enqueue_scripts not pulling