In my blog,i have to add a code to the page.php (a must for me)
I added the code and works fine in a specific page which i created but the problem is that,when i added the code all the other pages like contact,privacy policy shows it.I just want to show it in that specific page i created
An example:I created a page let's say X.I added below code to page.php
<?php if
(function_exists('fvCommunityNewsForm'))
fvCommunityNewsForm(); ?>
All the pages(contact,privacy policy) effected from this code.I don't want this code to be shown in those pages but only X page
Is there a way to exclude that code from other pages not to show it?
How to exclude an added(to page.php) code from pages?(Wordpr
Moderator: General Moderators
Re: How to exclude an added(to page.php) code from pages?(Wo
There is a way and off the top of my head I can't completely remember how. We use a similar thing with headers, wanting different flash objects to show up on different page headers. You can do it within a template in WP, however I've not done it myself and would have to ask. Alternatively, you could try using a case. I also did one using a set of IF statements based on page url using a snippet of code whichs grabs the url and then displays a picture based on whether the variable I set up was equilivant to that of the current page.
http://codex.wordpress.org/Pages#Creati ... _Templates < That may be of some use, but being a wordpress dev myself I know just how long their info pages are.
http://codex.wordpress.org/Pages#Creati ... _Templates < That may be of some use, but being a wordpress dev myself I know just how long their info pages are.
Re: How to exclude an added(to page.php) code from pages?(Wo
Someone told me to try something like this
if(get_the_ID()==2){ .................
2 is the ID of page X
but didn't work
if(get_the_ID()==2){ .................
2 is the ID of page X
but didn't work
Re: How to exclude an added(to page.php) code from pages?(Wo
Like I said before you may simply have to set up a template for that page, so that it uses the code, and other pages use a different template.
Re: How to exclude an added(to page.php) code from pages?(Wo
Ok got the solution
<?php
if(get_the_ID()==2){
if (function_exists('fvCommunityNewsForm'))
fvCommunityNewsForm();
}
?>
2 is the ID of the page
When i write the ID of the page it only shows on that specific page
<?php
if(get_the_ID()==2){
if (function_exists('fvCommunityNewsForm'))
fvCommunityNewsForm();
}
?>
2 is the ID of the page
When i write the ID of the page it only shows on that specific page