【问题标题】:Retrieving data from customer area wordpress从客户区wordpress检索数据
【发布时间】:2016-11-28 08:00:32
【问题描述】:

我正在尝试将 wordpress 上一些帖子的标题加粗,我有这段代码:

 <?php
    $title_popup = sprintf(__('Uploaded on %s', 'cuar'), get_the_date());
    $file_count = cuar_get_the_attached_file_count($post->ID);
    if(strpos(get_the_title(get_the_ID()),'Garajes Gran')!==false){
    ?>

        <tr>
           <td class="cuar-title">
             <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr($title_popup); ?>"><strong><?php the_title(); ?></strong></a>
           </td>
           <td class="text-right cuar-file-count">
             <span class="label label-rounded label-default"><?php echo sprintf(_n('%1$s file', '%1$s files', $file_count, 'cuar'), $file_count); ?>   </span>
          </td>
        </tr>
     <?php
      }

而且我没有得到我想要的,因为所有标题都显示为黑色。所以出了什么问题?我的头衔是:

 Presupuestos (Garajes Gran Via)    0 files
 Presupuestos (Viviendas)   0 files
 Contratos (Garajes Gran Via)   5 files
 Contratos (Viviendas Gran Vía) 6 files
 Contadores de Agua 0 files
 Estatutos (Viviendas)  1 file
 Estatutos (Garajes Gran Vía)

非常感谢。

【问题讨论】:

    标签: wordpress


    【解决方案1】:

    而不是使用 the_title();使用 get_the_title();

    <td class="cuar-title">
                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr($title_popup); ?>"><strong><?php echo get_the_title(); ?></strong></a>
    </td>
    

    【讨论】:

    • 它不起作用,因为当我这样做时,标题消失了。谢谢
    • 你在呼应吗?
    • 这样
    • 我忘记了回声,但它不起作用,因为所有内容都以粗体显示
    猜你喜欢
    • 1970-01-01
    • 2017-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-04
    • 2021-12-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多