I'm trying to assign a php file to a specfic page? I have modals stored in different files and want have them load in when their assigned page is called. These pages are using the same theme, "Portfolio".
If I do something like:for each file in my Portfolio template, each page will still load all of the modals that are assigned, not just the one that I'm try to assign to that page. Is there a way to try this in functions.php? EDIT: My apologies for not being clear, so I'll show the pages. Here's a sample of the portfolio page with the image buttons: [sample portfolio page]. Apologies if you can't view the link, it's still on the server and hasn't launched just yet. All of the "work" pages are going to hold the modal buttons. All of these pages will be duplicates of the same page template. So that load won't be affected by having a bunch of modals just hanging in my header, I think it would be great to have the modals properly cataloged and only called when needed, sort of like a data feed (I imagine). In my theme, there's a folder called *"modals"* and for this page we would need to call '/modals/work/thunderModals.php' for 'page-id-1270'. I have not yet implemented the last 2 suggestions but I will get started. Thank you to everyone who is helping out on this. Your time is greatly appreciated. : http://rpm2018.rpmadv.com/index.php/work/thundervalley/ So, I read through the wp hierarchy and through there I was looking for how to properly target slugs and I found this: ID ); ?>
I went back to my portfolio.php template (which is the shell for all of my work/child pages). So to that I appended an 'include'. Now I have something like this:
<?php get_page_template_slug('page-id-1270'); include '/modals/work/thunderModals.php';?>
Seems to work so I added a few more lines for my other pages. But when I got to my other portfolio.php-themed pages, I can see that all of the modals are loaded in, including the modals for the other pages. New question:
Can this line of code be modified so that the files will remain specific to their page?