duanhegn231318 2019-07-12 15:05
浏览 40

在enfold主题中显示自定义字段值

I've googled around and know how to get a custom field to show in the standard wordpress themes by copying...

    <?php echo get_post_meta($post->ID, 'Mood', true); ?>

into the correct php file. Happy days.

I know the location with the Enfold theme I want my CF to show and the exact piece of code to tweak...

    if($show_meta && !empty($excerpt))
                    {
                        $meta  = "<div class='slide-meta'>";
                        if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio')
                        {
                            $link_add = $commentCount === "0" ? "#respond" : "#comments";
                            $text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' );
                            $meta .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add}</a><p>TEST</p></div><div class='slide-meta-del'>/</div>";
                        }
                        $markup = avia_markup_helper(array('context' => 'entry_time','echo'=>false, 'id'=>$the_id, 'custom_markup'=>$custom_markup));
                        $meta .= "<time class='slide-meta-time updated' $markup>" .get_the_time(get_option('date_format'), $the_id)."</time>";
                        $meta .= "</div>";

                        if( strpos($blogstyle, 'elegant-blog') === false )
                        {
                            $output .= $meta;
                            $meta = "";
                        }

So my question is how do I get the CF to show where TEST is on line 8? Copying the first piece of code into place just returns errors...

Notice: Undefined variable: post in /config-templatebuilder/avia-shortcodes/postslider.php on line 575

Notice: Trying to get property of non-object in config-templatebuilder/avia-shortcodes/postslider.php on line 575

Thanks in advance. Keep the answer simple... I'm a n00b (Y)

TJ

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 matlab yalmip kkt 双层优化问题
    • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多
    • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
    • ¥15 有赏,i卡绘世画不出
    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题