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
- 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
- Add custom image sizes to media uploader
- Is $hook a global variable in WordPress
- Show different Customizer Settings on Page-Tamplates
- 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
- Include a php file from functions.php only to homepage
- Customizer Show/Hide
- Shortcode content output but not in correct place
- How to restrict page access to logged-in users?
- Handling Body class based on Template
- Adding Default Settings to Theme My Login plugin
- 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
- Alter required message using comment form api
- Edit the_category (); for a hierarchical display
- Why does this update_post_meta function not delete the custom field itself?
- WordPress Customizer Default Image
- Using data sent via AJAX in multiple functions on a WP plugin
- Detecting if parent page has gallery
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- Utilize Function in Child Theme / Template File
- Help with WordPress function inside a shortcode
- How to have different site identity logos on each page on Astra Theme [closed]
- Removing “Powered by” footer using child theme PHP [closed]
- Overide Variable in Child Theme
- How to style injected code in header section?
- Randomize Color Scheme Selection in Theme
- Include a file that has a function in it
- Execute Jquery when a specific page in my plugin is loading
- AJAX function not working [closed]
- SQL error with custom query
- How to preload header logo image in WordPress? like what’s the code and where do I put it?
- Contain multiple page templates in one PHP custom template file in WordPress?
- How do I reopen the (Popup Maker) after entering the correct password for a password protected page?
- Display metabox galleries on specific page template in admin editor
- display condition based on post term and status
- Only the first image uploads
- Custom plugin: how do I call a PHP file if settings option is set to true?
- removing the standard dashboard widgets in WP so I Can replace with custom
- Gravity Forms: How to add PHP function to confirmation conditional shortcode?
- wpdb->query returns different value to phpMyAdmin
- How to put 2 php codes in functions.php without site crashing
- How to change order inside foreach using wp_enqueue_script?
- Change header on one page in WordPress
- How do I get the value of a current user’s custom field?
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- Allow Comments by Default for Multiple Post Types
- Cleaner ‘for each’ loop for registering scripts in functions.php
- How to get User Avatar Image with link to Author and User name in Html Title tag?
- WP HTTP API call response
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Make customizer panel or section button
- How to get all users by user_login as a json_encode array?
- How to make 2 similar functions more efficient
- Echo multiple tasks if a common function exists
- Add end mark at the end of every article
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- Custom meta box save values issues – Deprecated: Function ereg() and more
- Ninja Forms – pull in some post related information
- Functions are causing errors
- Global variables and re-use
- wp_head makes my custom page template not work in Customizer?
- Issues separating my Plugin pages into different files
- Link to external page has wordpress blog-url inside
- AJAX: WordPress filters inside $html do not work as intended
- Appending an ACF custom field to the page title
- In WordPress how do you remove render-blocking CSS manually without a plugin?
- WordPress generating Undefined Variable warning