Site icon Hip-Hop Website Design and Development

loading a php file to a particular web page id

I am attempting to assign a php file to a specfic web page?

I’ve modals saved in numerous recordsdata and wish have them load in when their assigned web page is known as. These pages are utilizing the identical theme, "Portfolio".

If I do one thing like:

<?php $id="page-id-8229"; embrace '/modals/work/cplfModals.php';?>

for every file in my Portfolio template, every web page will nonetheless load all the modals which are assigned, not simply the one which I am attempt to assign to that web page.

Is there a manner to do this in features.php?

EDIT: My apologies for not being clear, so I will present the pages.

This is a pattern of the portfolio web page with the picture buttons:
pattern portfolio web page.
Apologies if you cannot view the hyperlink, it is nonetheless on the server and hasn’t launched simply but.

The entire "work" pages are going to carry the modal buttons. All of those pages will probably be duplicates of the identical web page template. In order that load will not be affected by having a bunch of modals simply hanging in my header, I believe it could be nice to have the modals correctly catalogued and solely referred to as when wanted, kind of like an information feed (I think about).

In my theme, there is a folder referred to as "modals" and for this web page we would want to name /modals/work/thunderModals.php for page-id-1270.

I’ve not but applied the final 2 ideas however I’ll get began. Thanks to everybody who helps out on this. Your time is enormously appreciated.

So, I learn via the wp hierarchy and thru there I used to be in search of learn how to correctly goal slugs and I discovered this:

<?php echo get_page_template_slug( $post->ID ); ?>

I went again to my portfolio.php template (which is the shell for all of my work/little one pages). So to that I appended an ’embrace’. Now I’ve one thing like this:

<?php get_page_template_slug('page-id-1270'); embrace '/modals/work/thunderModals.php';?>

Appears to work so I added a number of extra traces for my different pages. However once I acquired to my different portfolio.php-themed pages, I can see that all the modals are loaded in, together with the modals for the opposite pages. New query:

Can this line of code be modified in order that the recordsdata will stay particular to their web page?