Here is a modified version of your original code. Your echo statement isn’t right and really isn’t necessary. It’s probably better to jump out of PHP like I’ve done in the code below. Also, the unnecessary else
statement was removed:
<?php
$servicescontent = get_theme_mod( 'services-page', 1 );
$abc = get_theme_mod( 'services-check', 1 );
$mod = new WP_Query( array( 'page_id' => $servicescontent ) );
while ( $mod->have_posts() ) : $mod->the_post();
if ( $abc == 1 ) { ?>
<div class="section default-bg">
<div class="container">
<h1 id="services" class="text-center title"><?php the_title();?></h1>
<div class="space"></div>
<div class="row">
<?php the_content();?>
</div>
</div>
</div><!-- section end --><?php
}
endwhile;
Related Posts:
- Return a numerical function value in Customizer controls
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Getting text from custom field from customizer
- Need help setting default setting value for radio button in theme customizer
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- Dynamically change feature image in customiser
- One button to change all settings in theme customizer?
- Design view breaking on Pages
- if has theme mod
- How to add default images into theme customizer image control?
- Crop image from get_theme_mod Customizer field
- Skt full width basic slideshow problem
- How to check if a Customizer setting is set?
- Please show me how to use an if/else statement in combination with wp_enqueue
- Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS
- Need advice on theme customizer and child themes
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Access preview settings in php
- How to add button to top of theme customizer?
- How can I clear the theme mod settings?
- Cant get theme to change footer color through theme customizer
- Sections dependent on checkbox the WordPress WP_Customize_Control
- Block error message in foreach loop when looping through ACF field
- Include User ID in iFrame URL
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- not outputting medium size image URL
- Gutenberg block don’t save rich text content
- Search by date in WordPress
- Run a sql (update) after 12 hours after the user login. Woocommerce users
- Wp_Schedule_Event every few minutes doesn’t work
- Get current user id in function php
- Proper way to remove html code on child theme
- remove_action from parent theme using child theme functions.php
- Trying to add Custom Post Type to this functions.php command
- Add Pre-Defined Value to Click Counter in WordPress
- Apply function.php filter only if url not has /amp/
- Hide a div if the fiels is empty
- File from parent theme imported to child theme doesn’t work – any ideas?
- Illegal string offset checkbox
- Ajax filter with loadmore button
- Cant get blog name with get_option
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- Preventing direct access to a page in WordPress
- How to use data URL in WordPress?
- php code for outputting a custom page in my account
- How can I redefine WordPress wp-content directory programmatically?
- Trim Titles Only On Some Pages
- Flushing the slug base has no effect and does not change
- HTML comment cause issue in functions.php script root
- Custom global variable not working in function
- ssl redirect function is not working
- Hide specific shipping methode depending on day and time of day
- Programmatically add a product to the cart and set price to zero when buying from certain category
- I want to show cart items number if any or nothing, simple CART text
- update_user_meta as multiple value but with same meta key
- Adding custom field to product category and show it to shop/category shop page
- Embed video from streamtape using direct link
- Hide payment method based on user role AND minimum cart value
- Is there a PHP function that will return the block ID generated by WordPress?
- Custom plugin: how do I call a PHP file if settings option is set to true?
- retrieve “Link Color” value
- How can I prevent a shortcode div from extending beyond its boundaries?
- Creating a Function and Call It
- posts_per_page displays only 2 posts instead of 4 posts
- WooCommerce display price before add to cart [closed]
- Change lost password url to a mailto URL in WordPress
- PHP multiple forms, same page, isset($_POST[]) not working?
- Get parent category name when only child category is applied to a product
- Show sidebar only to author of post
- Outputting post content to jQuery .html() string
- removing the standard dashboard widgets in WP so I Can replace with custom
- Gravity Forms: How to add PHP function to confirmation conditional shortcode?
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- wpdb->query returns different value to phpMyAdmin
- shortcodes, custom php and their errors
- Remove span tags from WooCommerce Downloads page
- How can i avoid duplicate same post in wp?
- Get custom field value from the function.php
- Non-blocking file_put_contents in function.php
- How to move a post from one category to another
- Best way to use variables in multiple functions?
- Child theme overirde template-tags in a theme built on underscores in inc/template-tags
- Trying to add some custom text into WordPress Post title via function.php
- Display a custom name when the user has no name settle in his account
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Show data obtained from a function and place it in a shortocode function
- register_block_type is not working properly
- How can i create a function tag in my plugin
- Delete post meta by serialized meta value
- How can I edit a php custom page template to work in other themes?
- PHP “warning include_once(): Failed to open stream” Simple HTML DOM in WordPress Child Theme
- Multiple cron jobs vs daily cron job doing multiple things? Which one yields better performance and scalability?
- Edit a function to take different actions based on user role
- get_the_author_meta( ‘ID’ ) just return 1
- How to put 2 php codes in functions.php without site crashing
- Update $wpdb query with AJAX
- Exclude category from function – PHP
- how to add custom select field to wordpress edit page
- Advance custom fields variable with if statement & Function
- How to change order inside foreach using wp_enqueue_script?