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?
- Prevent “main” WPMU site_url() being returned in functions
- Custom page with variables in url. Nice url with add_rewrite_rule
- How to use the do_action () with parameter
- Create “File-less” Page Template in Functions.php
- Extract image from content and set it as the featured image
- Do WordPress’ cron’s clean up expired transients?
- Refresh page after form action
- How to restrict actions and filters “properly” by conditions
- How to count number of functions attached to an action hook?
- Filter the query ONLY for the search results page
- Using add_filter() in Widgets
- Is it possible to use a forgot password url filter?
- Using get_terms for custom taxonomy in functions.php
- Fatal error: Call to undefined function add_action() – an untouched problem
- Custom page template how to check is_page from functions.php?
- Call to undefined add_action() in theme’s functions.php
- How can I rename the WordPress AJAX URL? [duplicate]
- Programmatically set page template based on page ID
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Automatically Add Specified Value to Attachment Metadata upon Upload
- Adjust which tempalte a page uses with a function?
- Can’t Update function.php after writing short code
- How to update feed only 2-3 times a week (for Feedburner email)?
- How to specify which Gutenberg blocks are available in the editor for a page template
- Filtering posts by category name based on page’s slug
- How would go about if I just want a temporary function?
- Passing arguments to my function with do_action and add_action is not working
- Pass parameters to function through an action
- Accepted arguments value in hook functions
- Load parent theme files before child theme functions.php
- How to select a page within admin?
- How to manage arrays from custom functions stored in functions.php?
- How do I pass arguments for multiple functions hooked to a single action?
- Which action hook to use for function?
- Ninja form Redirect depending on text field content [closed]
- Custom HTML in specific category single page and its descendant categories
- Modify a function without editing template
- Which action does wp_update_user triggers?
- Trigger a custom function when option are saved in admin area
- Removing custom meta data
- WordPress on AWS Auto scaling and ELB giving 503
- WordPress converts media extention URL automatically to video player
- Reuse variable in hook callback
- Redirect to another page if the user is logged in when pressing again the login button on menu bar
- How to load parent theme template parts in child theme
- Difference b/w Simple function call & do_action call
- Pass parameter to hooked function using custom page template
- Get arguments from URL
- add_action template_redirect not working for home page
- I can’t seem to install Font Awesome locally [closed]
- Is there a way to prevent a function/method from being called outside a specific hook?
- Add unique id to Preview URL
- Auto-Tweet if Type is ‘Status’ using OAuth
- Missing argument for the function
- problem loading stylesheets to wp_head dynamically
- Adding code before post title with the_title produces weird results
- How to properly refresh page after form action?
- Init action and refresh page after form action
- Insert Content Before div#main from the functions.php File
- Problem in using Customizer
- 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
- include w_thumbnail_src in function?
- Create Custom URL structure for specific Post category using Post ID instead of post name
- 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
- reWrite wp-content url to point on my cdn
- Does hook have an effect on increasing the page load?
- Save_post – Warning: Cannot modify header information
- How do I trigger WP CLI DB export using a PHP function?
- 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
- Is_Page doesnt detect my page
- Postback redirect through add_action is not triggered
- 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
- Pagination won’t work on custom page
- WordPress hooks to call a function inside a construct
- Edit meta fields from within template
- Fatal error: Call to undefined function add_action() – an untouched problem
- Pass arguments to function class with do_action()
- is_page_template wont allow me to enqueue scripts
- What add_action reference should I be using or should I use do_action?
- Getting error while trying to use custom comment function
- How do I change the URL returned by next_posts_link()?
- function to return comma separated list of meta values
- HELP: Code To Check Status And Write Debug Entry
- Logout redirect via page template without confirmation?
- Template Redirect Function Only Working When Logged In
- 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
- is there a list of actions on WordPress
- Remove Actions/Filters added via Anonymous Functions