The first issue I can see is you’re missing a wrapping set of parentheses on your if statement:
your code:
if ( 'page' == $post->post_type )
&& ( $templateURL == "template=services" )
{...
should be:
if ( 'page' == $post->post_type && $templateURL == "template=services" )
{...
I don’t know for sure if that will fix your problems but it’s a definite problem.
Is there a specific reason you want these to be pages and not custom post types? If you were to create three custom post types, you’d be able to use the templates as singles for your posts, which would apply your styling and ACF fields. It’s a less hack-y solution as well.
Related Posts:
- Sending Messages Back to the Template After Processing?
- What’s the difference between home_url() and site_url()
- remove_action on after_setup_theme not working from child theme
- Remove Actions/Filters added via Anonymous Functions
- Trying to use add_action and do_action with parameters
- Prevent “main” WPMU site_url() being returned in functions
- Custom page with variables in url. Nice url with add_rewrite_rule
- Define page template in wp_insert_post
- Check if post is being published for the first time, or is an already published post being updated
- Add custom template page programmatically
- Define custom Page Template without its own .php file
- How to use the do_action () with parameter
- Perform an action when post is updated/published
- Create “File-less” Page Template in Functions.php
- WordPress Theme Update Action?
- Extract image from content and set it as the featured image
- Do WordPress’ cron’s clean up expired transients?
- add_action in a function, is it possible?
- Changing where my author box is printed
- Protect get_query_var from manual input in url
- Insert Content Before div#main from the functions.php File
- Problem with images URL after filter applying
- Use add_action within template
- Problem in using Customizer
- Problem with custom function when I go back with the browser
- Page Template Won’t Load Correct CSS File
- Replace admin header logo with an image
- New checkbox in custom widget isn’t saving data
- How do I find the code executed when wp_head() is called?
- Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy
- How i can get the URL?
- Function to check if custom page is used by page?
- template_redirect action only firing if logged in
- include w_thumbnail_src in function?
- Unable to use get_page_by_title() more than once per page?
- Create Custom URL structure for specific Post category using Post ID instead of post name
- How to use wp_enqueue_script properly?
- Fetch URL parameter
- how can I change all wordpress media file url to custom cdn url?
- Custom route and extract data from slashes and parameter
- Using get_terms for custom taxonomy in functions.php
- reWrite wp-content url to point on my cdn
- Issue passing action class to nested function. Admin Columns
- Does hook have an effect on increasing the page load?
- Probleme shortcode with list author
- Save_post – Warning: Cannot modify header information
- What is the earliest Hook a Script can use?
- How do I trigger WP CLI DB export using a PHP function?
- If has action not working as expected
- How Can I Create a Friendly Slug for a Dynamic Page?
- Modifying a WordPress Plugin
- Add #primary at the end of navlink permalinks on single posts
- post value to function with Ajax and jQuery
- Enqueue script if not page template
- Is_Page doesnt detect my page
- How do you insert code into the sidebar?
- How Do I Unhook This Parent Theme Function?
- How to show only specific category post by user role without plugin and restrict all other cats
- Set URL Parameter Post Layout As Default
- Postback redirect through add_action is not triggered
- use add_action in a shortcode (gravity form – WordPress)
- wp_footer hook causing text to show on bottom of page
- Remove action hook from Class, understanding OOP
- How to change form action of wp-login page with a function
- remove_action() not working in page template – Genesis
- More than one search results page template for two searches on site
- Which method is more correct for removing WooCommerce Extensions menu item?
- Pagination won’t work on custom page
- WordPress hooks to call a function inside a construct
- Edit meta fields from within template
- Using Switch Statement to Change Image According to Last Digit of Topic ID
- True parameter but jquery register in header and not in the footer with wp_register_script
- Fatal error: Call to undefined function add_action() – an untouched problem
- Pass arguments to function class with do_action()
- previous_post_link inside of a function?
- custom COOKIE on custom page
- is_page_template wont allow me to enqueue scripts
- Instead of using $post, how do i get the thumbnail image of the $post
- What add_action reference should I be using or should I use do_action?
- How to add a meta information to the URL?
- Getting error while trying to use custom comment function
- Settings in functions.php used by a plugin
- How to use different jquery function of idangero swiper dependant on page template?
- How do I change the URL returned by next_posts_link()?
- Function in functions.php by url
- function to return comma separated list of meta values
- Do something when user creates post (that’s pending)
- add variable to actions/functions across different files (woocommerce)
- HELP: Code To Check Status And Write Debug Entry
- Logout redirect via page template without confirmation?
- Template Redirect Function Only Working When Logged In
- delete_term is not working properly with add_action()
- How to get variable from other function inside class function using add_action for Ajax call
- Function attached to cron job not running but will run if called manually
- Submit CF7 form programmatically with WP-Cron?
- disable a specefic sidebar when user is log out
- wp_update_post breaks my function
- Is there a way to batch-find unlinked text URLs in the body text of all my posts and link them?
- is there a list of actions on WordPress
- Remove Actions/Filters added via Anonymous Functions