dongrang9300 2016-12-06 20:33
浏览 13
已采纳

“in_category”[关闭]时更改页面标题

So I'm not sure what happened but this was working until the update to Wordpress 4.7. Can someone please help me figure out why my page header is still showing default "News & Events" when on any single post?

  if( $subheader_show ){
                        echo '<div id="Subheader" style="'. $subheader_style .'">';
                            echo '<div class="container">';
                                echo '<div class="column one">';

                                    // Title
                                    $title_tag = mfn_opts_get( 'subheader-title-tag', 'h1' );
                                    if( in_category('news' || 'community' || 'events')) {
                                    echo '<'. $title_tag .' class="title">News & Events</'. $title_tag .'>';
                                    } elseif( in_category('attorneys')) {
                                    echo '<'. $title_tag .' class="title">Attorneys</'. $title_tag .'>';
                                    } elseif( in_category('publications')) {
                                    echo '<'. $title_tag .' class="title">Publications</'. $title_tag .'>';
                                    } else {
                                    echo '<'. $title_tag .' class="title">'. mfn_page_title() .'</'. $title_tag .'>';
                                    }

                                    // Breadcrumbs
                                    if( $breadcrumbs_show ) mfn_breadcrumbs( $breadcrumbs_link );

                                echo '</div>';
                            echo '</div>';
                        echo '</div>';
                    }
  • 写回答

1条回答 默认 最新

  • doukun5339 2016-12-06 20:37
    关注

    You're using in_category function incorrectly.
    It accepts int, string or array. In your case it should be in_category(array('news', 'community', 'events')). I have no clue how it was working before, because nothing changed with this function in 4.7 as far as I can see.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大