Ads only Home Page

Posted in: Newspaper
Post count: 6

Hi, I want add in, ads only in home page, and to in other posts category, but I have a customer that want only on home page. How can i do this it ? Need be in Header.

I’m using the Plugin WP PRO ADVERTISING SYSTEM and their speaking to add this shortcode [pro_ad_display_adzone id=”18836″] or/and …

…but I don’t know where !!

looking the explication their.
_____________________________
Using the Template Tag

The “template tag” is the solution to add adzones to places on your website where you can’t use shortcodes or widgets. It allows you to hard code the adzone into your theme files on the exact location where you want the adzone to be.

To use the template tag first create the shortcode for your banner with all the options you like. Once you have the shortcode just copy and paste it into the template tag.

<?php
echo do_shortcode(“add the shortcode here”);
?>

Note: The template tag requires some PHP knowledge. It has to be added into your theme files so if you don’t know how to add the template tag contact your theme developer, provide him the template tag and ask where it should be added to show the adzone where you want it to be.

Default Template Tag Example

<?php
/**
* id = {adzone_id}
*/
echo do_shortcode(“[wpproads_banner id=123]”);
?>

Post count: 22421

Hello,

f you want the code to be added to the header, you should add it in the header style file that you use: https://www.screencast.com/t/QTX5WCnGU8l
Please note this is not tested and we cannot say for sure if the plugin works or not with our theme.

Thank you!

Post count: 6

Ok Bogdan, thanks.

But, this is don’t go alter header of all pages ?
I need alter only home page.

Post count: 6

Should not I use is_home()?

I read something about it but I do not know how to use it … please, could you help me !!

Post count: 22421

Hello,

The function simply detects if the page is set as a homepage or not. You can use it to wrap your code inside it and it will only apply if the page is set as a homepage.
https://developer.wordpress.org/reference/functions/is_home/

Thank you!

Post count: 6

Hi bogdan, I sorry, but I need help, yet.
How I can identify if my home page é a — is_home() ?
Why don’t work yet ?

look please: I am using this Style – 1

<!–
Header style 1
–>
<div class=”td-header-wrap td-header-style-1″>

<div class=”td-header-top-menu-full td-container-wrap <?php echo td_util::get_option(‘td_full_top_bar’); ?>”>
<div class=”td-container td-header-row td-header-top-menu”>
<?php td_api_top_bar_template::_helper_show_top_bar() ?>
</div>
</div>

<div class=”td-banner-wrap-full td-logo-wrap-full td-container-wrap <?php echo td_util::get_option(‘td_full_header’); ?>”>
<div class=”td-container td-header-row td-header-header”>
<div class=”td-header-sp-logo”>
<?php locate_template(‘parts/header/logo-h1.php’, true);?>
</div>
<div class=”td-header-sp-recs”>
<?php
if(is_home()){
echo do_shortcode(‘[pro_ad_display_adzone id=18836]’);
}
else{
locate_template(‘parts/header/ads.php’, true);
}
?>
</div>
</div>
</div>

<div class=”td-header-menu-wrap-full td-container-wrap <?php echo td_util::get_option(‘td_full_menu’); ?>”>
<div class=”td-header-menu-wrap td-header-gradient”>
<div class=”td-container td-header-row td-header-main-menu”>
<?php locate_template(‘parts/header/header-menu.php’, true);?>
</div>
</div>
</div>

</div>

If this all right, so the problem is in (is_home())??

thank you very mutch

Post count: 22421

Hello,

If is_home will not work maybe you can try this function: https://codex.wordpress.org/Function_Reference/is_front_page

The code seems to be right but you must check exactly what the function is looking for and what it returns.

Thanks

Post count: 6

Hi, Bogdan. Thank you very mutch for atenttion
I think I found the solution, but I’m not quite sure how to deploy it.

I would like to insert in home a different header from the other pages.
I would like to create a header for home like this:

header-home.php

But how do you call it on Home?

But how should I use this function in the theme? Since it already has the system of choice of Header Style (header-style-1.php, header-style-2.php, etc.).

I found this:

<? Php
If (is_home ()):
Get_header (‘home’);
Elseif (is_404 ()):
Get_header (‘404’);
Else:
Get_header ();
Endif;
?>

Post count: 22421

Sorry but you will have to hire a freelancer if you need any further help with customization. We do not have a customization department and time doe snot allow us to tackle custom work.

Thank you for your understanding.

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.