PHP按小部件中的类获取元素(wordpress)

时间:2018-10-30 08:32:29

标签: php wordpress widget getelementsbyclassname

现在我的帖子中的$ ticker是由标记定义的,非常适合小部件

H$XB <- with(H, subset(X, Ingrowth == "B"))
H
#> Hyperframe:
#>       X    XB
#> 1 (ppp) (ppp)
#> 2 (ppp) (ppp)
plot(H$XB, which.marks = "Ingrowth")

screenshot tag

,但是有帖子,其中没有任何标签。 而且我需要从标签或文章的跨度中获取$ ticker:

span class ticker screenshot

我该怎么办?

如果需要,可以在此处进行标签搜索:

Global $wp_query;
        $post_id = $wp_query->get_queried_object_id();
        $tags = wp_get_post_tags($post_id);
        $category = get_the_category($post_id);
        $isHome = is_front_page();
        $isArticle = !(empty($tags) || is_category());
        //if (!$isHome && !$isArticle && empty($args['force'])) return;

        // before and after widget arguments are defined by themes
        echo $args['before_widget'];
        if (!empty($title))

        echo $args['before_title'] . $title . $args['after_title'];
        $ticker = tr_get_ticker($post_id);

        $sector = tr_get_sector($post_id);


        if( $title = apply_filters( 'widget_title', $instance['title'] ) )
            echo $args['before_title'] . $title . $args['after_title']; ?>


    <div class="more-equities-research-at-tipranks" style="margin: 25px 0 15px 0;">
        <h3>More <span class="equities-name"><?php echo $ticker ?></span> Research at TipRanks</h3>

0 个答案:

没有答案