0
は、私は(テーマのパネルから定義されたカテゴリを呼び出す)、このようなコードを持って与える方法:
<?php query_posts ('ignore_sticky_posts=1&showposts=1&cat='.get_cat_id
($up_options->category1)
);
すべてが正常に動作しますが場合にISSETを追加する必要がありますカテゴリは定義されませんでした。
私はこのようなISSETを与える:
<?php query_posts ('ignore_sticky_posts=1&showposts=1&cat='.get_cat_id(
(isset($up_options->category1) && $up_options->category1))
);
しかし、動作しませんでした。 誰でも助けてくれますか?私はPHPが初めてです。
ありがとうございました。ここで
フルコード:
<div class="wrapper">
<?php query_posts ('ignore_sticky_posts=1&showposts=1&cat='.get_cat_id($up_options->category1));
if (have_posts()) :
while (have_posts()) : the_post();?>
<div class="inside">
<div class="title">
<h5> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo substr(the_title('', '', false), 0, 75); ?>...</a> </h5>
</div>
</div>
<?php endwhile; endif; wp_reset_query();?>
</div>
残念ながら私はこのエラーが発生します。注意:5行目のオブジェクト以外のプロパティを取得しようとしています。5行目は$ cat_idです。 – Mailmulah
私は同じコードをテストしました。あなたのコードを共有できますか? – jakob
更新された答えを確認してください。私はそれをテストし、それは正常に動作します – jakob