フォーラムへの返信

5件の返信を表示中 - 16 - 20件目 (全20件中)
  • トピック投稿者 ng

    (@nogud)

    自己解決しましたのでご報告です。

    パーマリンク設定→共通設定にてカスタム構造にチェックを入れており、下記のように設定しておりました。

    /%category%/%year%%monthnum%%day%%hour%%minute%%second%.html

    このcategory部分をblogcatに変更したところ404エラーがなくなりtaxonomy.phpテンプレートが適用されるようになりました。

    知識が足らず、なぜ正常に反映されるようになったのかは不明ですが、ご報告までに。

    mypacecreatorさん、おつきあいいただきありがとうございました。

    トピック投稿者 ng

    (@nogud)

    mypacecreatorさん

    ありがとうございます。

    頂いたリンク先の内容を一通り試しましたが、やはり404でした。
    何がおかしいのかさっぱりです。。

    現状のソースはこちらです。

    register_post_type(
    	'blog',
    	array(
    		'label' => 'Blog',
    		'public' => true,
    		'hierarchical' => false,
    		'query_var' => false,
    		'capability_type' => 'post',
    		'menu_position' => 25,
    		'has_archive' => true,
    		'rewrite' => array('slug' => 'blog'),
    		'exclude_from_search' => false,
    		'supports'=> array('title'),
    		'taxonomies' => array('blogcat'),
                'labels' => array (
                	'name' => 'Blog',
                    'singular_name' => 'Blog'
                )
    
    		)
    	);
    	register_taxonomy(
        'blogcat',
        'blog',
        array(
          'hierarchical' => true,
          'query_var' => true,
          'rewrite' => array( true ),
          'label' => 'カテゴリー',
          'singular_label' => 'カテゴリー',
          'show_ui' => true
        )
    );
    
    //Add RewriteRule
    function my_custom_post_type_permalinks_set($termlink, $term, $taxonomy){
    	return str_replace('/'.$taxonomy.'/', '/', $termlink);
    }
    add_filter('term_link', 'my_custom_post_type_permalinks_set',11,3);

    よろしくお願いいたします。

    トピック投稿者 ng

    (@nogud)

    何度もありがとうございます。
    タクソノミー名を変更したところ、ついにtaxonomy.phpが表示されるようになりました!
    予約語は全く知りませんでした。非常に勉強になります。ありがとうございます。

    そこで、現状、http://xxx.com/post_type/taxonomy/term となっているのを
    http://xxx.com/post_type/term というURL表記にするために、削除したAdd RewriteRuleを復活させましたが、URL表記は上記のようになるのですが、404エラーとなってしまいます。(404.php)

    こちらでもtaxonomy.phpを表示させたいのですが、
    ご教授頂けますと幸いです。。

    トピック投稿者 ng

    (@nogud)

    いえ、無効にしても404でした。
    さらにパーマリンクをデフォルトにしても404でした。

    追記:個別記事はテンプレートphpがちゃんと反映されています。
    http://xxx.com/blog/css/xxx.html

    追記2:現在タームが2つあるのですが、cssは404になりますが、もう1つのwebというタームはindex.phpのテンプレが適用されるようになっていました。。

    よろしくお願いいたします。

    トピック投稿者 ng

    (@nogud)

    返信ありがとうございます。

    ご指摘のとおり、削除後に更新でやってみましたが、404エラーとなりました。
    ちなみにblogページにてtermリストの書き出しを行い、そこにterm_linkにて飛び先を設定しております。
    削除前は http://xxx.com/blog/css という風になっていたのですが、
    削除後はhttp://xxx.com/blog/cat/css というURLが書き出されています。

    また、1つ伝え忘れていましたが、Custom Post Type Permalinksの「カスタム分類のアーカイブのパーマリンクを変更する。」にチェックを入れております。
    リンクはhttp://xxx.com/post_type/taxonomy/termに変更されてますとなっています。

    よろしくお願いいたします。

5件の返信を表示中 - 16 - 20件目 (全20件中)