Just assign something to a variable and output that
if(is_page(14) or is_page(16))
{ $class_name="bannerExp"; }
if(is_page(18) or is_page(52) or is_page(22) or is_page(20))
{ $class_name="bannerD";
$somevariable="test";
}
if(is_page(27))
{$class_name="bannerJ";}
if(is_page(25))
{$class_name="bannerS";}
if(is_page(2))
{$class_name="bannerH";}
<div class="<?php echo($class_name);?>">
<?php (if $somevariable != '') { echo $somevariable;} ?>
That being said, this is a horrible way of doing things and you should look into custom page templates, rather than having to check for page id’s and writing if statements for every case scenario… this defeats the point of having a cms.
Related Posts:
- Add custom HTML to posts page
- Clickable image link sends people to wrong URL
- Displaying images outside the content
- Changing 2011 theme header image based on user dropdown
- How do I change/modify the_post_thumbnail(); html output?
- WordPress Shortcode and Dynamic CSS
- Multiple pages on one with different HTML
- Minify HTML, CSS, JS with PHPWee?
- Using PHP to toggle stylesheet and header image, set in cookie
- How to display a value from a radio button in the options menu in wordpress
- Change logo based on incoming domain
- How to scale image with equal width and height without distortion?
- Shortcode content output but not in correct place
- An unwanted inline style is added to my body tag
- Show post in slider
- Echo URL of large version of Featured Image
- How can I hide Home in my menu in a specific page?
- Missing sidebar parameter “fix” – before_content
- Get different images for mobile and desktop with php, advanced custom fields without using js and ajax
- How Display Posts on category
- add_image_size for header_image
- how to remove metadata from the posts of my blog?
- Responsive Header for Phone
- Customize position of social icons in upme plugin [closed]
- Different post styles depending on category
- How create a Shortcode with hover and complex options
- WordPress Multiple Navigation bars
- “imagejpeg” function is not working in wordpress
- Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Wrapping a Sidebar within
- Add Codepen animation as Preloader to WordPress
- Where can I find the inline-css of my theme header?
- Menu Custom Data Attributes
- Highlight the links without using dropdown
- Website completely messes up when logging out
- Need help removing […] after excerpt
- Link to page with posts of specific type
- CSS images don’t show up with bloginfo
- How to internationalize header image?
- how to changes mobile menu toggle breakpoint in WordPress
- Background image no longer fits to screen now that project is in php files
- Add other class content with reference class value
- PHP function for horizontal Woocommerce thumbnails and badges
- I can’t go to the page archive-{post_type}.php
- Configure WordPress to Use Responsive Image Rendering
- How to use data URL in WordPress?
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- Drop down question
- WP Website is shown in HTML
- Can’t display anything through homepage text editor
- How to find and delete a menu item in php?
- WordPress Slider is not working
- How to display post meta bellow every posts
- how to add functions to my function.php using a child theme?
- Add my footer menu to the header
- Make a full-width wordpress page
- Target a specific container to style on WordPress storefront theme
- user update profile for custom code
- Font-Family does not looks like how it should be [closed]
- Where to find the html for WordPress site? [closed]
- Show contact 7 form in popup
- WordPress – Image href for home menu nav not working
- How Can I Center the Logo in the Navigation Menu? [closed]
- featured post as div background
- Trying to customize wordpress drop down categories
- Gallery requires a featured image but does not show it in posts/pages
- Cant get theme to change footer color through theme customizer
- Converting Menu Links to List Elements
- HTML in PHP problem [closed]
- How to customize posts in WordPress by using HTML and CSS?
- WP_Query not returning results
- Header location [closed]
- How do I link the side images?
- Parse error: syntax error, unexpected ‘}’ in
- Sorting Problem
- How to create a container in php then customise it in CSS
- Custom HTML/CSS Theme into WordPress – SEO considerations
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- Using Featured Image as Hero Background in Word Press
- How to create different templates for woocommerce single-product.php?
- How to add a class to the attachment images
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- wp_enqueue_style with style.php and WordPress functions
- Displaying theme options in css
- Input data from email form not going to JSON file
- Hide HTML element (by class or ID) with PHP
- Illegal string offset error in wordpress theme options textarea
- jQuery accordion menu
- Controlling image output size ACF repeater [closed]
- I have a lot of JavaScript erorrs after SSL someone can help me?
- How to center all text body in single.php at once?
- AMP version of e-commerce without plugin
- nested divs, classes for a grid in loop [duplicate]
- How to use plugins_url() inside PHP stylesheet file [duplicate]
- Php echo into tag
- Adding slides to an existing carousel manually
- Add multiple HTML attributes to an Elementor button