drnzpd579935 2015-06-15 15:38
浏览 12

Wordpress函数建议 - 这可能是针对特定函数并在其后执行另一个函数吗?

Ok... so working on a theme designed by Astoundify... which although beautiful has been disgustingly made.

Also using WP Job Manager.

Have created a new custom field, 'fax'. Want fax to display after the phone number. Astoundify has nicely made this display on the theme using a widget - making the WP Job Manager hooks completely useless.

What i need to do is get that fax number to display immediately after phone. Is this possible to do with the functions file so that i don't have to modify the core files?

The following is the code which is outputting the phone number:

public static function the_phone() {
    global $post;

    $phone = $post->_phone;

    if ( ! $phone ) {
        return;
    }


?>
    <div class="job_listing-phone">
        <span itemprop="telephone"><a href="tel:<?php echo esc_attr( preg_replace( "/[^0-9,.]/", '', $phone ) ); ?>"><?php echo
        esc_attr( $phone ); ?></a></span>
    </div>
<?php
}

And i am trying to output the fax using the following:

add_action( 'single_job_listing_start', 'display_fax_number_data', 50 );

function display_fax_number_data() {
  global $post;

  $fax = get_post_meta( $post->ID, '_fax', true );

  if ( $fax ) {
    echo '<li>' . __( 'Fax:' ) . ' ' . $fax . '</li>';
  }
}

And its working... just not in the right place. Have lost a day trying to do something that should have been so simple.

Any help appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看