← WordPress

Problema com Plugin

Lida 2007 vezes

Offline

Fernando Augusto 
Membro
Mensagens 922 Gostos 0
Feedback +1

Troféus totais: 30
Trófeus: (Ver todos)
Linux User Mobile User Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3

Estou a utilizar o WordPress Multiple Author Ad management (http://wordpress.org/extend/plugins/wordpress-multiple-user-ad-management/ ) para que cada autor do blog tenha os seus códigos adsense no final de cada artigo

O problema é que apenas o meu código adsense é o único que aparece. Para "chamar" as ads utilizo o  <?php mu_sidebar(get_the_author_id()); ?>

Na FAQ do plugin o autor diz:

Citar
The plugin only displays advertisements from the Default Admin account!

99% of the time this occurs as, get_the_author_id() WordPress function is transferring a value of 0 to mu_sidebar(). In order to fix this, relocate the <?php mu_sidebar(get_the_author_id()); ?> after the WordPress loop. Additionally, you may replace get_the_author_id() with another function that inputs a userid value.

Que é o meu problema.

Como é que eu altero para outra função que "input" o valor do userid? Ou corrigir a parte do Wordpress loop?

O meu single.php

Código: [Seleccione]
<?php get_header(); ?>

<div id="content">

<div id="sharebox">

<div class="float">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink() ?>" data-text="<?php the_title(); ?>" data-count="vertical" data-via="mulhersaudavel">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>

<div class="float">
<a name="fb_share" type="box_count" share_url="<?php the_permalink() ?>"
      href="http://www.facebook.com/sharer.php">Share</a>
    <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
</div>

<div class="float">
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=box_count&amp;show_faces=false&amp;width=55&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:55px; height:65px;">
</iframe>
</div>

<div class="float">
<g:plusone size="tall"></g:plusone>
</div>

</div>

<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>

  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  <h1 class="singletitle">
    <?php the_title(); ?>  </h1>
  <div class="byline">

    <div class="clear"></div>

    </div>

  <div class="entry">

        <?php the_content(''); ?>

<?php if ( !in_category(36) && !in_category(37) && !in_category(38) && !in_category(39) ) { ?>
<?php mu_sidebar(get_the_author_id()); ?>
<?php ?>

    <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:30px;"></iframe>
<div class="clear"></div>
<g:plusone size="medium" href="<?php the_permalink(); ?>"></g:plusone>

   <div class="postmeta"> <strong>Categorias:</strong>
      <?php the_category(',');?><p></p>      <?php the_tags('<span>Tags:</span> '', '' '); ?>
      <?php edit_post_link('Edit''[ '' ]'); ?>
    </div>
<!-- single_post -->
<div class="partilhar"> <div class="titulo-partilhar">Gostou deste artigo? Partilhe no <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>"> <img src="<?php bloginfo('wpurl'); ?>/wp-content/themes/tema/images/facebook.png" alt="Partilhar no Facebook" width="32" height="32" border="0" /></a> ou no <a href="http://twitter.com/home?status=A ler <?php the_permalink(); ?>"> <img src="<?php bloginfo('wpurl'); ?>/wp-content/themes/tema/images/twitter.png" alt="Partilhar no Twitter" width="32" height="32" border="0" /></a>!

</div>
 </div>     <div class="clear"></div>


    <!--end: postmeta--->
  </div>
  <!--end: entry-->
  <div class="postnav">
    <div class="left">
      <?php previous_post_link('%link''<div class="previouspost">&laquo; Anterior</div>%title'TRUE);  ?>
    </div>
    <div class="right">
      <?php next_post_link('%link''<div class="nextpost">Seguinte &raquo;</div>%title'TRUE); ?>
    </div>
    <div class="clear"></div>
  </div>
  <!--end: postnav-->
<?php comments_template(); ?>
<?php endwhile; else: ?>
  <h2 title="h2title">
    <?php _e('Nada encontrado'); ?>
  </h2>
  <div class="entry">
    <?php _e('Desculpa, mas esse artigo não existe.'); ?>
  </div>
  <!--end: entry-->
  <?php endif; ?>
</div>
<!--end: content-->
<?php include('post-sidebar.php'); ?>
<?php get_footer(); ?>

Offline

Fernando Augusto 
Membro
Mensagens 922 Gostos 0
Feedback +1

Troféus totais: 30
Trófeus: (Ver todos)
Linux User Mobile User Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3

Alguém mais expert pode dar um ajudinha?
Offline

yanko 
Membro
Mensagens 59 Gostos 0
Troféus totais: 16
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Level 3 Level 2 Level 1 50 Posts 10 Posts First Post Karma

Se percebi bem, essa função recebe o id do autor do post e mostra os anúncios que estão associados a esse autor. É isso? E tens criados anúncios em autores que têm artigos da sua autoria? E mostra sempre o teu?

Tens algum tipo de cache ligada? Pode ser browser cache (já fizeste Ctrl + F5). Parece que o comportamento normal faz o que pretendes, portanto é estranho não estar a mudar...
Offline

Fernando Augusto 
Membro
Mensagens 922 Gostos 0
Feedback +1

Troféus totais: 30
Trófeus: (Ver todos)
Linux User Mobile User Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3

Exacto mostra sempre o meu e os outros tem os seus anúncios criados.

Tenho o w3 Total Cache instalado
Offline

yanko 
Membro
Mensagens 59 Gostos 0
Troféus totais: 16
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Level 3 Level 2 Level 1 50 Posts 10 Posts First Post Karma

Já fizeste purge à cache? Faz um echo da author id que é enviado para dentro da função e verifica se está correcto com o da base de dados.

Se for 0 faz um print_r da variavel $post. O ID do autor deverá lá estar dentro...
Offline

yanko 
Membro
Mensagens 59 Gostos 0
Troféus totais: 16
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Level 3 Level 2 Level 1 50 Posts 10 Posts First Post Karma

E se não funcionar, talvez isto...

global $wp_query;
$thePostID = $wp_query->post->ID;
$postdata = get_postdata($thePostID);
$authorID = $postdata['Author ID'];
Offline

Fernando Augusto 
Membro
Mensagens 922 Gostos 0
Feedback +1

Troféus totais: 30
Trófeus: (Ver todos)
Linux User Mobile User Windows User Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3

Já desliguei o outro plugin e continuou.

Não percebo nada do que escreveste xD, sei muito pouco de programação