GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Simple <php> question / Wordpress (https://gfy.com/showthread.php?t=1221154)

Smack dat 10-11-2016 12:30 PM

Simple <php> question / Wordpress
 
Pretty sure this is simple to do but sent a message to the plugin support and they completely ignored my question and replaced it with their own made up version.

Basically I have a slider plugin (Slider WD) and I was given some PHP code:

Code:

<?php wd_slider(1); ?>
All I want to do is restrict the plugins use on specific pages like page-ID=2 or something.

How would I do this please?

Paul&John 10-11-2016 01:03 PM

Looks like you need is_page().. havent tested this, found at stackoverflow:

Code:

<?php if(is_page( 5 ): ?>
    <p>This is some text</p>
<?php endif; ?>


Smack dat 10-11-2016 01:38 PM

Quote:

Originally Posted by Paul&John (Post 21215116)
Looks like you need is_page().. havent tested this, found at stackoverflow:

Code:

<?php if(is_page( 5 ): ?>
    <p>This is some text</p>
<?php endif; ?>


Cheers, I will try it.

Bird 10-11-2016 02:51 PM

Can't you just copy the pages template and rename it and upload it to the same template folder then select it in your edit pages post on the right side under page attributes select template.

Smack dat 10-11-2016 03:04 PM

Quote:

Originally Posted by Bird (Post 21215377)
Can't you just copy the pages template and rename it and upload it to the same template folder then select it in your edit pages post on the right side under page attributes select template.

And then....?

shake 10-11-2016 03:39 PM

Quote:

Originally Posted by Smack dat (Post 21215398)
And then....?

Then that file will become the template custom for that url / page.

potter 10-12-2016 07:08 AM

Quote:

Originally Posted by Bird (Post 21215377)
Can't you just copy the pages template and rename it and upload it to the same template folder then select it in your edit pages post on the right side under page attributes select template.

So duplicate (potentially) hundreds of lines of PHP into a new template file to write one line of custom code for the page? Smaaart

HowlingWulf 10-12-2016 08:06 AM

Quote:

Originally Posted by Paul&John (Post 21215116)
Looks like you need is_page().. havent tested this, found at stackoverflow:

Code:

<?php if(is_page( 5 ): ?>
    <p>This is some text</p>
<?php endif; ?>


This is the correct answer.

https://developer.wordpress.org/refe...tions/is_page/

xxx6live 10-12-2016 10:55 AM

And if you get an error now, I think there must be TWO parentheses before the first colon. Looks like you are not a coder, just trying to help. :)

Code:

<?php if(is_page( 5 )): ?>

CurrentlySober 10-12-2016 01:23 PM

Quote:

Originally Posted by Smack dat (Post 21215398)
And then....?



No and then !


All times are GMT -7. The time now is 09:31 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123