SWELLで辞書サイト4

コードのメモ書き

(あとで整理する)

 

 

	$args = [
		'post_type'      => $attrs['postType'],
		'type'           => $attrs['listType'],
		'count'          => $attrs['listCount'],
		'ignore_sticky'  => ! $attrs['addSticky'],
		
		// 'order'          => $attrs['order'],
		// 'orderby'        => $attrs['orderby'],

		'order'          => 'ASC',
		'orderby'        => 'meta_value',
		'meta_key'        => 'ふりがな',
		
		'max_col'        => $attrs['pcCol'],
		'max_col_sp'     => $attrs['spCol'],
		'more'           => $attrs['moreText'],
		'more_url'       => $attrs['moreUrl'],
		'excerpt_length' => 0,
		'cat_pos'        => $attrs['catPos'],
		'show_title'     => $attrs['showTitle'],
		'show_date'      => $attrs['showDate'],
		'show_modified'  => $attrs['showModified'],
		'show_author'    => $attrs['showAuthor'],
		'show_pv'        => $attrs['showPV'],
		'h_tag'          => $attrs['hTag'],
	];

 

 

		// 'order'          => $attrs['order'],
		// 'orderby'        => $attrs['orderby'],

		'order'          => 'ASC',
		'orderby'        => 'meta_value',
		'meta_key'        => 'ふりがな',

 

			// 並び順
			$orderby = $block_args['orderby'];
			if ( 'pv' === $orderby ) {
				$q_args['meta_key'] = SWELL_CT_KEY;
				$q_args['orderby']  = 'meta_value_num';
			} elseif ( 'rand' === $orderby ) {
				$q_args['orderby'] = 'rand';
			} else {
				$q_args['orderby'] = $orderby;
			}

			$q_args['order'] = 'ASC';
			$q_args['orderby'] = 'meta_value';
			$q_args['meta_key'] = 'ふりがな';

 

$query->set('meta_key', 'ふりがな');
$query->set('orderby', 'meta_value');
$query->set('order', 'ASC');

 

Post_List.php

<?php
namespace SWELL_THEME\Parts;

if ( ! defined( 'ABSPATH' ) ) exit;


/**
 * 投稿リスト生成用クラス
 * ・通常の呼び出し
 * ・ブロック|ショートコードからの呼び出し
 * ・ウィジェットからの呼び出し
 */
class Post_List {

うさ吉

群馬出身埼玉在住。
趣味(写真や小旅行)についてつらつらと書き綴ってます。

うさ吉をフォローする
WordPress
シェアする
うさ吉をフォローする
うさログ

コメント