Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Sidebars & Widgets »

Dynamic Ads into Widget - How?


  #1  
Old Aug 27, 2012, 02:19 PM
Regist
 
5 posts · Aug 2012
Hi!

My site is http://multivarkavari.ru/
WordPress 3.1.2.
Atahualpa 3.6.7 (thanks! ).

And my question is about widget with ads in right up corner of site.
I want that each time the different advertizing chosen in a random way there was shown.
For this purpose I have a php function but where it to insert?

Thanks!
  #2  
Old Aug 27, 2012, 02:43 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
There are plugins that give you widgets you can put php code in. If you want the widget in the top of the site you may have to add a new widget area per the instructions in the Add New Widget Area section of the theme options.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #3  
Old Aug 28, 2012, 12:11 AM
Regist
 
5 posts · Aug 2012
Yes, I went this way (using plugin PHP Code Widget), but for some reason the code doesn't work, advertizing isn't shown

If I simply insert a code into a simplt text widget
--------
<!-- Яндекс.Директ --><script type="text/javascript">yandex_partner_id = 84403;yandex_site_bg_color = 'FFFFFF';yandex_site_charset = 'utf-8';yandex_ad_format = 'direct';yandex_direct_type = '180x150';yandex_direct_border_type = 'block';yandex_direct_border_radius = true;yandex_direct_header_bg_color = 'CC6666';yandex_direct_bg_color = 'FFCCCC';yandex_direct_border_color = 'CC6666';yandex_direct_title_color = '990000';yandex_direct_url_color = '990000';yandex_direct_text_color = '000000';yandex_direct_hover_color = 'CC6666';yandex_direct_favicon = true;document.write('<sc'+'ript type="text/javascript" src="http://an.yandex.ru/system/context.js"></sc'+'ript>');</script>
--------
This works (rose ads in up rigth sidebar).

But if i'm insert into php code widget
--------------
<?php
return '<div id="market"><!-- Яндекс.Маркет -->
<script type="text/javascript">
yandex_partner_id = 84403;
yandex_site_bg_color = \'FFFFFF\';
yandex_stat_id = 3;
yandex_site_charset = \'utf-8\';
yandex_ad_format = \'direct\';
yandex_direct_type = \'180x150\';
yandex_direct_header_bg_color = \'CC6666\';
yandex_direct_bg_color = \'FFCCCC\';
yandex_direct_title_color = \'990000\';
yandex_direct_url_color = \'990000\';
yandex_direct_text_color = \'000000\';
yandex_direct_hover_color = \'CC6666\';
yandex_direct_favicon = true;
document.write(\'<sc\'+\'ript type="text/javascript" src="http://an.yandex.ru/system/context.js"></sc\'+\'ript>\');
</script></div>';
>
--------------
this doesn't works!

Is given to me, I do something incorrectly!
What?
  #4  
Old Aug 28, 2012, 03:15 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
ou don't have a closing '?>' but you don't need to use PHP in anycase, try
HTML Code:
<div id="market"><!-- Яндекс.Маркет -->
<script type="text/javascript">
yandex_partner_id = 84403;
yandex_site_bg_color = \'FFFFFF\';
yandex_stat_id = 3;
yandex_site_charset = \'utf-8\';
yandex_ad_format = \'direct\';
yandex_direct_type = \'180x150\';
yandex_direct_header_bg_color = \'CC6666\';
yandex_direct_bg_color = \'FFCCCC\';
yandex_direct_title_color = \'990000\';
yandex_direct_url_color = \'990000\';
yandex_direct_text_color = \'000000\';
yandex_direct_hover_color = \'CC6666\';
yandex_direct_favicon = true;
document.write(\'<sc\'+\'ript type="text/javascript" src="http://an.yandex.ru/system/context.js"></sc\'+\'ript>\');
</script></div>
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Aug 28, 2012, 03:47 PM
Regist
 
5 posts · Aug 2012
I need to realize the following:
$x=rand (1,5);

and then, depending on x to show
either advertizing 1, or advertizing 2 etc.

But when I tried to realize it by means of php, inserting a code into a widget, found out that it doesn't work.
Debugging function I cleaned code slices, yet it was not necessary simply - to deduce continuous advertizing, but by means of php. It doesn't work.

It is not obligatory to me to do it on php, it is simple as then it is possible to realize it - to alternate advertizing in a widget in a random way?
  #6  
Old Aug 28, 2012, 04:25 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
if you are displaying an ad based on a random number, then yes you need to do it using PHP.
Just remember you have to have your syntax correct in order for it to work.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #7  
Old Aug 29, 2012, 02:49 AM
Regist
 
5 posts · Aug 2012
Oh, this code in PHP Code Widget doesn't working!

HTML Code:
<?php
 return '<div id="market"><!-- Яндекс.Маркет -->
 <script type="text/javascript">
 yandex_partner_id = 84403;
 yandex_site_bg_color = \'FFFFFF\';
 yandex_stat_id = 3;
 yandex_site_charset = \'utf-8\';
 yandex_ad_format = \'direct\';
 yandex_direct_type = \'180x150\';
 yandex_direct_header_bg_color = \'CC6666\';
 yandex_direct_bg_color = \'FFCCCC\';
 yandex_direct_title_color = \'990000\';
 yandex_direct_url_color = \'990000\';
 yandex_direct_text_color = \'000000\';
 yandex_direct_hover_color = \'CC6666\';
 yandex_direct_favicon = true;
 document.write(\'<sc\'+\'ript type="text/javascript" src="http://an.yandex.ru/system/context.js"></sc\'+\'ript>\');
 </script></div>';
?>
Widget is viewing nothing!

Maybe, this code returned string with code, but this string must be executing!
But how do this?

Last edited by juggledad; Aug 29, 2012 at 06:09 AM.
  #8  
Old Aug 29, 2012, 06:10 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
try this
HTML Code:
<?php // start of my php - but now I need to switch back to HTML
?>
<div id="market"><!-- Яндекс.Маркет -->
<script type="text/javascript">
 yandex_partner_id = 84403;
 yandex_site_bg_color = \'FFFFFF\';
 yandex_stat_id = 3;
 yandex_site_charset = \'utf-8\';
 yandex_ad_format = \'direct\';
 yandex_direct_type = \'180x150\';
 yandex_direct_header_bg_color = \'CC6666\';
 yandex_direct_bg_color = \'FFCCCC\';
 yandex_direct_title_color = \'990000\';
 yandex_direct_url_color = \'990000\';
 yandex_direct_text_color = \'000000\';
 yandex_direct_hover_color = \'CC6666\';
 yandex_direct_favicon = true;
 document.write(\'<sc\'+\'ript type="text/javascript" src="http://an.yandex.ru/system/context.js"></sc\'+\'ript>\');
 </script></div>
?<php // ok, now I am back in php
return;
?>
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #9  
Old Aug 29, 2012, 12:43 PM
Regist
 
5 posts · Aug 2012
the php code widget with this code deduces '?'
  #10  
Old Aug 29, 2012, 12:53 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
it doesn't deduce anything - if you want it to display different ads based on a random number, you need to code the routine that generates the random number, code to test it and display the approperate ad.

I would suggest creating the PHP code and testing it with just printing a word for each case. once you get it working, then you can add the ad code in.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks

Tags
sidebar coding, widget

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fixing widget to bottom of dynamic sidebars adamcmacdonald Sidebars & Widgets 2 Jul 6, 2010 04:08 PM
Dynamic Logo madfab685 Header configuration & styling 0 Oct 31, 2009 04:31 AM
[SOLVED] Dynamic Tagline madfab685 Header configuration & styling 2 Aug 16, 2009 10:56 AM
Do not upgrade dynamic headers - help! krystyna Plugins & Atahualpa 9 Aug 10, 2009 09:30 AM


All times are GMT -6. The time now is 05:10 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.