前提・実現したいこと
資料皆無でオリジナルテーマのWordPressを引き継ぎました。
「最新の投稿が(タイトルなしで)一覧ページの下方に表示」されるので、
これを「一覧ページの上方に表示」させたいです。
発生している問題・エラーメッセージ
例: 既存2018タイトル 既存2017タイトル 新規2019(空白)
該当のソースコード
php
1functions.php 一部端折ってそのままの記述です。 2<?php 3require_once(get_parent_theme_file_path('/inc/custom-post-type.php')); 4 5// add_filter( 'post_type_link', 'my_post_type_link', 1, 2 ); 6// function my_post_type_link($link, $post){ 7// if ('construction' === $post->post_type) { 8// global $wp_rewrite; 9// echo $wp_rewrite->get_extra_permastruct($post->post_type); 10// // return home_url( '/constructions/' . $post->ID ); 11// } else { 12// // return $link; 13// } 14// return $link; 15// } 16// 17// add_filter( 'rewrite_rules_array', 'my_rewrite_rules_array' ); 18// function my_rewrite_rules_array( $rules ) { 19// $new_rules = array( 20// 'constructions/([0-9]+)/?$' => 'index.php?post_type=construction&p=$matches[1]', 21// ); 22// return $new_rules + $rules; 23// } 24 25// add_action('rest_api_init', function () { 26// register_rest_field( 27// 'constructions', 28// 'post_meta', 29// array( 30// 'get_callback' => function($object, $field_name, $request) { 31// $meta_fields = array( 32// 'wpcf-sub-title' 33// ); 34// $meta = array(); 35// foreach ($meta_fields as $field) { 36// $meta[$field] = get_post_meta($object[ 'id' ], $field, true); 37// } 38// return $meta; 39// }, 40// 'update_callback' => function($value, $object, $field_name) { 41// $subtitle = $value['sub-title']; 42// update_post_meta($object->ID, 'wpcf-sub-title', $subtitle); 43// } 44// , 45// 'schema' => null, 46// ) 47// ); 48// }); 49?> 50
試したこと
WP管理画面から一覧ページを編集できなく、投稿ページを編集すると表示が変に…
GREP検索で原因と思われるfunctions.phpにたどり着いたのですが、
コードが半分くらいしか理解できません。
補足情報(FW/ツールのバージョンなど)
関係があるか不明ですが、当時のWPバージョンが4.9以前かもしれなく、
現在5.1以降にUPしています。MySQL5.7、PHP7.1です。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。