質問編集履歴

2

ビジュアルの訂正

2016/09/13 10:40

投稿

J4CK1E
J4CK1E

スコア66

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  WordPressを利用して商品の一覧サイトを作成しております。
4
4
 
5
- ---
5
+
6
6
 
7
7
  ###実現したいこと
8
8
 

1

試したこと、実現したいことの詳細を明記

2016/09/13 10:40

投稿

J4CK1E
J4CK1E

スコア66

test CHANGED
File without changes
test CHANGED
@@ -2,21 +2,131 @@
2
2
 
3
3
  WordPressを利用して商品の一覧サイトを作成しております。
4
4
 
5
- 現在、[GK Portfolio](https://ja.wordpress.org/themes/gk-portfolio/)というテーマをいじって作成しておりますが、
5
+ ---
6
6
 
7
+ ###実現したいこと
8
+
7
- カスタムフィルドを使用し商品の情報入力する仕様にしため、わからな部分が出てきております
9
+ 現在トップペジに指定ている固定ページに、商品一覧(カテゴリ)表示させたい。
8
10
 
9
11
 
10
12
 
11
- ・トップページに新商品一覧を表示させたい
13
+ ###前提
12
14
 
13
- 現在トップペ、固定ペ設定しており、サイトの説明等が書いてあります。
15
+ ・[GK Portfolio](https://ja.wordpress.org/themes/gk-portfolio/)というテ作成
14
16
 
15
- に、カテゴリーを選択したのと同様に商品の一覧(新商品カテゴリ)を表示させたいと思っております
17
+ ・[こちら](http://design-plus1.com/tcd-w/2015/12/custom01.html)サイトを参考に、表示させようと思したが、そもそも指定るphpを作成することができず...(phpに関しての知識がないため)
16
18
 
17
19
 
18
20
 
21
+ ###発生した問題
22
+
23
+
24
+
25
+ test.phpというファイルを作成し、
26
+
27
+ ```PHP
28
+
29
+ <?php
30
+
31
+ get_header(); ?>
32
+
33
+
34
+
35
+ <div id="primary" class="content-area">
36
+
37
+ <div id="content" class="site-content archive" role="main">
38
+
39
+
40
+
41
+ <?php if (have_posts()) : ?>
42
+
43
+ <header class="archive-header">
44
+
45
+ <h1 class="archive-title"><?php printf( __('Category Archives: %s', 'portfolio'), '<strong>' . single_cat_title('', false) . '</strong>'); ?></h1>
46
+
47
+
48
+
49
+ <?php if (category_description()) : ?>
50
+
51
+ <div class="archive-meta"><?php echo category_description(); ?></div>
52
+
53
+ <?php endif; ?>
54
+
55
+ </header><!-- .archive-header -->
56
+
57
+
58
+
59
+ <?php while (have_posts()) : the_post(); ?>
60
+
61
+ <?php get_template_part('content-archive', get_post_format()); ?>
62
+
63
+ <?php endwhile; ?>
64
+
65
+
66
+
67
+ <?php else : ?>
68
+
69
+ <?php get_template_part('content', 'none'); ?>
70
+
71
+ <?php endif; ?>
72
+
73
+
74
+
75
+ </div><!-- #content -->
76
+
77
+ <?php portfolio_paging_nav(); ?>
78
+
79
+ </div><!-- #primary -->
80
+
81
+
82
+
83
+ <?php get_footer(); ?>
84
+
85
+ ```
86
+
87
+ を記述いたしました。
88
+
89
+
90
+
91
+ functions.phpに、
92
+
93
+ ```PHP
94
+
95
+ function Include_my_php($params = array()) {
96
+
97
+ extract(shortcode_atts(array(
98
+
99
+ 'file' => 'default'
100
+
101
+ ), $params));
102
+
103
+ ob_start();
104
+
105
+ include(get_theme_root() . '/' . get_template() . "/test.php");
106
+
107
+ return ob_get_clean();
108
+
109
+ }
110
+
111
+
112
+
113
+ add_shortcode('myphp', 'Include_my_php');
114
+
115
+ ```
116
+
117
+ という記述をし、
118
+
119
+ 固定ページ側に[myphp file=’test’]を記述したところ、
120
+
19
- 通常の場合ですと、カテゴリを選択すると画像一覧くる仕様なっていす。
121
+ トップページ内に「カテゴリが見つからない」旨メッセージループし延々
122
+
123
+ 表示されている状態となりました。
124
+
125
+ そもそも指定するphpの内容が間違えているのではないかと思いますが、
126
+
127
+ 知識が乏しいため、どのようにすればよいかわからず,,,
128
+
129
+
20
130
 
21
131
 
22
132