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
- How to hide get_theme_mod if field empty
- How to get the original price of the product in woocommerce?
- Calling a method from functions.php on a click of a button
- How to redirect users to custom lostpassword page?
- How to change featured content to a different tag in WordPress Twenty Fourteen?
- Can I write ‘RewriteCond’ using ‘functions.php’?
- How to add 2 posts under another post? Formatting should be intact
- WordPress menu deletes when trying to add a hook
- Overriding a theme redux file in child theme
- Validate a users email address when using gmail to register
- Get widget settings function?
- Making Quote Plugin more efficient
- What is the fastest way to load PHP functions that are only used in one theme template?
- Adding tawk.to code just before body tag on functions.php file
- allow subscribers to see private posts without plug in
- add_action shortcut?
- remove wp floating submenu in wp dashboard
- ACF: how do I get the fields and its values of a specific group?
- Get page that displays all children of taxonomy parent
- How can I get the values of my WordPress $wpdb query in Jquery?
- Function to capture a value and store it in a variable
- Adding a widget function into the php theme file
- My new button is in the wrong place
- Checking array against author id in loop
- Call to undefined method – Download Monitor
- How do I link a button I created in theme customizer to a function?
- How to change menu labels
- How to obtain the current website URL in my theme?
- Plugin Generate Unexpected output during activation
- Remove Custom Divs from AMP pages
- Read array in php?
- Tell WP register script to load a script only when the entire page is loaded
- Can’t save php string to a custom field
- get_template_directory adding FTP root folders in urls
- Is it possible to display a DIV to not logged in users and then change it for users who are logged in?
- Remove extract from function
- Undefined offset: 3 in custom function
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- How to add data to a custom field at the wp_users table?
- How to make a cookie be on the whole site instead of being on a specific page/
- call a string/function from database
- Grabing default from cuztomizer php file instead of other php script
- Can/should we delete wordpress cron jobs with no action?
- Database entry removed on browser refresh, Ajax PHP jQuery
- How a HTML form can trigger a PHP function?
- Allow a user or role to view drafts and previews, but not other admin privileges?
- Display Visual Composer shortcode if a post belongs in specific categories
- Preventing direct access to a page in WordPress
- How to use data URL in WordPress?
- Flushing the slug base has no effect and does not change
- Multiple cron jobs vs daily cron job doing multiple things? Which one yields better performance and scalability?
- JQuery modal not loading video on popup, only displaying it after multiple reopenings
- Get user by meta data key and velue
- Logo custom width not implementing
- Woocommerce textarea format ignored
- custom post type column countdown
- Add another role to a user when they click a button?
- Using wordpress functions in class and change my code to OOP PHP
- Creating wordpress user registration form
- Add missing alt tag to featured images for “storefront” theme
- Notice: Undefined index: post_title error
- Unable to pass arguments to function used in add_action
- What is the proper way to call a function (from functions.php) on a link click?
- Load admin bar without wp_head or wp_footer [duplicate]
- Allow user to select location and then set cookie for location in WordPress
- Multiple sections in Theme Customizer overwritten
- Sort on two variables
- Retrieving specific images from Media Library
- WordPress get_post_meta issue
- Woocommerce Price Text
- Limit Taxonomy Parents
- WordPress HTML Helper
- List sibling pages widget, exclude current page
- Send foreach $_post method to contact form 7 [closed]
- Options.php loop won’t show!
- Contact form with dynamic dropdown and filter
- Critical Error customiser
- Automatically change insurance quantity based on cart total [closed]
- hiddenQuestions.find is not a function