← WordPress

problema com upgrade para wordpress 3.0.1

Lida 3353 vezes

Offline

raugusto 
Elite
Mensagens 3145 Gostos 33
Feedback +13

Troféus totais: 31
Trófeus: (Ver todos)
Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Hoje estava a fazer um upgrade do wordpress a um amigo e uma das funcionalidades do site deixou de funcionar. Não estava habituado ao tema, mas depois de verificar, vi que na template da homepage, uma das funcionalidades deixou de funcionar.

<?php
            // Updated 2.24.10
            // If home_slider_replacement widget is in use, display  it's contents (replaces the slider)
             if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('home_slider_replacement') ) : endif;
            
            // Check if this page has content, if so display it in a 12 column wide area
            $content = get_the_content();
            if($content)
            {
               echo "<div class='grid_12' id='header_test'>";
               include("teaser.php");
               echo"</div>";
               echo "<div class='grid_12'>".$content . "</div>";
            }
         ?>

Basicamente é uma condição que se existe conteúdo (a homepage é definida no settings -reading como a pagina home) mostra um teaser.php e depois o conteudo da pagina.

Pelo que pude verificar, eventualmente a função get_the_content() que deixou de retornar o conteudo...

alguem ajuda?
Offline

STronic 
Elite
Mensagens 546 Gostos 8
Feedback +5

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

se queres mostrar todo o conteudo da página, talvez trocares isso pelo "the_content()" funcione ;)

$content = the_content();
            if($content)
            {
               echo "<div class='grid_12' id='header_test'>";
               include("teaser.php");
               echo"</div>";
               echo "<div class='grid_12'>";
               the_content();
               echo "</div>";
            }
Offline

STronic 
Elite
Mensagens 546 Gostos 8
Feedback +5

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

ou nem precisas fazer a verificação...

ao não haver o "the_content" ele simplesmente nao faz nada.. ;)
Offline

raugusto 
Elite
Mensagens 3145 Gostos 33
Feedback +13

Troféus totais: 31
Trófeus: (Ver todos)
Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

mas existe conteudo, a função é que penso que deixou de retornar...
Offline

Pedro Lopes 
Beta tester
Mensagens 3568 Gostos 18
Feedback +6

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3

Em vez de get_the_content(), tenta o the_content().
Offline

STronic 
Elite
Mensagens 546 Gostos 8
Feedback +5

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

Em vez de get_the_content(), tenta o the_content().

mas sem o "echo" ;) tal como expliquei acima.
Offline

betanalista 
Membro
Mensagens 2564 Gostos 0
Feedback +18

Troféus totais: 26
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

o pedro e o stronic já te deram a resolução, pensa que seja a que eles deram

só uma duvida isso ai depois do if tem um else certo? (ai mais para baixo no fim do if)  :wink:
Offline

raugusto 
Elite
Mensagens 3145 Gostos 33
Feedback +13

Troféus totais: 31
Trófeus: (Ver todos)
Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

o problema é que nem o the_content() me mostra o resultado. Aqui fica um excerto de uma outra template que deixou de funcionar:

<?php
/*
   Template Name: Concepts
*/
   get_header();
   $col = get_column_data($custom_settings["layout"]["columns"]); // get column data for layout - can be overriden 
?>
<div class="clearfix">
      <div id="teaser_small_concepts" class="grid_12"></div>
       <?php
      echo "<div class='grid_9'>";
      //echo "<div class='grid_".$col[1]."'>";
      ?>
       
        <div class="post">
           <?php get_thumbnail_above_post($post->ID, $col[1]); ?>
         <?php $hide_thumbnails_by_custom_field = get_post_meta($post->ID, "hide_thumbnails", true); ?>
         <?php
         
         $thumbnail_width = 2; // # of columns based on 960.js
         
         /* Get max items by custom field: posts_per_page */
         $max = get_post_meta($post->ID, "posts_per_page", true);
         if($max){ $max = "&posts_per_page=".$max; }
         
         $categories = get_post_meta($post->ID, "categories", true);
         if($categories) { $param = "cat=".$categories; }else{ $param = ""; }
         
         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
         query_posts($param . "&paged=" . $paged . $max);
         
         global $more; $more = 0;
      ?>
       
      <?php $count = 0; ?>
      <?php if (have_posts()) : ?>
         
         
         <?php if(!get_post_meta($post->ID, "hide_content", true)){ ?>
            <div class="grid_8 clearfix"><?php the_content(); ?></div>
         <?php } ?>
         <?php $count = 0; ?>
         <?php while (have_posts()) : the_post(); ?>
            
            <?php if ($count % 3 == 0 && $count > 0) { ?>
               <div class="clearfix grid_8" style="height:25px;"></div>
            <?php } ?>
            
            <?php $count++; ?>

(etc...)


Para me mostrar o conteudo tive que substituir o <?php the_content(); ?> pelo que está na referida pagina que usa esta template.

Alguem percebe o que é o hide_content que aparece como parametro?
Offline

raugusto 
Elite
Mensagens 3145 Gostos 33
Feedback +13

Troféus totais: 31
Trófeus: (Ver todos)
Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

resolvi numa das templates acrescentando:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

antes...desta forma the_content() retorna o que quero...

mas noutra das templates ainda tenho um problema.
Há alternativas para as paginas ao the_content()?