'#fffef0','card_border'=>'#e2c97e','card_border_width'=>'1','card_radius'=>'12','card_shadow'=>'yes','title_color'=>'#1a202c','title_size'=>'17','title_weight'=>'bold','excerpt_color'=>'#718096','excerpt_size'=>'14','readmore_color'=>'#3b82f6','btn_bg'=>'#3b82f6','btn_color'=>'#ffffff','btn_radius'=>'6','img_height'=>'200','accent_color'=>'#3b82f6','sidebar_bg'=>'#f8fafc','meta_color'=>'#94a3b8','meta_size'=>'12','custom_css'=>''];} function apf_color_field($name,$value){$colors=['#ffffff','#f8fafc','#1e293b','#000000','#fef2f2','#ef4444','#b91c1c','#fff7ed','#fb923c','#fefce8','#facc15','#ca8a04','#f0fdf4','#4ade80','#16a34a','#eff6ff','#60a5fa','#3b82f6','#1d4ed8','#eef2ff','#818cf8','#6366f1','#fdf4ff','#c084fc','#a855f7','#7e22ce','#fdf2f8','#f472b6','#ec4899','#fffef0','#e2c97e','#94a3b8','#64748b','#374151','#f1f5f9','#e2e8f0','#cbd5e0','#0f172a','#312e81','#1e1b4b','#f59e0b','#d97706','#22c55e','#15803d','#7c3aed','#dc2626'];echo '
';foreach($colors as $c) echo '';echo '
';} function apf_number($n,$v,$min=0,$max=100){echo '';} function apf_select($n,$v,$opts){echo '';} function apf_get_post_types_list(){$types=get_post_types(['public'=>true],'objects');$l=[];foreach($types as $t) $l[]=['name'=>$t->name,'label'=>$t->label];return $l;} function apf_get_taxonomies_list(){$taxes=get_taxonomies(['public'=>true],'objects');$l=[];foreach($taxes as $t) $l[]=['name'=>$t->name,'label'=>$t->label];return $l;} function apf_get_all_posts_data(){ $apf_all_posts = get_posts(['post_type'=>'any','posts_per_page'=>-1,'post_status'=>'publish','fields'=>'ids']); $apf_posts_data = []; if (!empty($apf_all_posts)) { foreach($apf_all_posts as $pid){ $title = get_the_title($pid); $apf_posts_data[] = ['id'=>$pid,'title'=>!empty($title)?$title:'(no title)']; } } return $apf_posts_data; } function apf_get_all_categories_data(){ $apf_cats_data = []; $tax_objs = get_taxonomies(['public'=>true], 'objects'); if (!empty($tax_objs)) { foreach ($tax_objs as $t_name => $t_obj) { if (in_array($t_name, ['nav_menu', 'link_category', 'post_format'], true)) continue; $terms = get_terms([ 'taxonomy' => $t_name, 'hide_empty' => false, ]); if (!is_wp_error($terms) && !empty($terms)) { foreach ($terms as $t) { $t_label = !empty($t_obj->labels->singular_name) ? $t_obj->labels->singular_name : (!empty($t_obj->label) ? $t_obj->label : $t_name); $apf_cats_data[] = [ 'id' => $t->term_id, 'title' => $t->name, 'slug' => $t->slug, 'taxonomy' => $t->taxonomy, 'tax_label' => $t_label ]; } } } } if (empty($apf_cats_data)) { $cats = get_categories(['hide_empty'=>false]); if (!is_wp_error($cats) && !empty($cats)) { foreach ($cats as $c) { $apf_cats_data[] = [ 'id' => $c->term_id, 'title' => $c->name, 'slug' => $c->slug, 'taxonomy' => 'category', 'tax_label' => 'Category' ]; } } } return $apf_cats_data; } add_action('admin_menu',function(){add_menu_page(__('Post Filter','ajax-post-filter'),__('Post Filter','ajax-post-filter'),'manage_options','apf-settings','apf_render_settings_page','dashicons-filter',58);add_submenu_page('apf-settings',__('Style Settings','ajax-post-filter'),__('Style Settings','ajax-post-filter'),'manage_options','apf-settings','apf_render_settings_page');add_submenu_page('apf-settings',__('Shortcode Generator','ajax-post-filter'),__('Shortcode Generator','ajax-post-filter'),'manage_options','apf-generator','apf_render_generator_page');}); add_action('admin_init',function(){register_setting('apf_settings_group','apf_settings','apf_sanitize_settings');}); add_action('admin_enqueue_scripts',function($hook){ if(strpos($hook,'apf')===false) return; wp_enqueue_style('apf-admin',APF_URL.'assets/admin.css',[],APF_VERSION); wp_enqueue_script('apf-admin-js',APF_URL.'assets/admin.js',['jquery'],APF_VERSION,true); wp_localize_script('apf-admin-js','apf_posts_list',apf_get_all_posts_data()); wp_localize_script('apf-admin-js','apf_categories_list',apf_get_all_categories_data()); }); function apf_sanitize_settings($in){$d=apf_default_settings();$c=[];$hex=['card_bg','card_border','title_color','excerpt_color','readmore_color','btn_bg','btn_color','accent_color','sidebar_bg','meta_color'];$ints=['card_border_width','card_radius','title_size','excerpt_size','btn_radius','img_height','meta_size'];foreach($hex as $f){$c[$f]=isset($in[$f])&&preg_match('/^#[0-9a-fA-F]{3,6}$/',trim($in[$f]))?sanitize_hex_color(trim($in[$f])):$d[$f];}foreach($ints as $f){$c[$f]=isset($in[$f])?absint($in[$f]):$d[$f];}$c['card_shadow']=isset($in['card_shadow'])&&$in['card_shadow']==='yes'?'yes':'no';$c['title_weight']=in_array($in['title_weight']??'',['bold','600','700','normal'])?$in['title_weight']:'bold';$c['custom_css']=isset($in['custom_css'])?wp_strip_all_tags($in['custom_css']):'';return $c;} function apf_render_settings_page(){ $s=wp_parse_args(get_option('apf_settings',[]),apf_default_settings()); if(isset($_GET['settings-updated'])) echo '

'.esc_html__('Settings saved.','ajax-post-filter').'

'; ?>

'Yes','no'=>'No']);?>
'Bold','600'=>'600','700'=>'700','normal'=>'Normal']);?>

.apf-wrapper .apf-post .apf-post-title .apf-post-excerpt .apf-read-more .apf-load-more .apf-sidebar

'button button-primary ajaxpose-save-btn']);?>

🔍
📅
📌
🏷
🖼️
🚫

📂

📋
[ajaxpose_post_filter]
📚
ParamDefaultOptions
postpostpost type(s)
taxonomycategorytaxonomy/ies
filter_typecheckboxcheckbox|radio|select
taxonomy_config—{"cat":"radio","tag":"select"}
cols31|2|3
per_page6number
load_typebuttonbutton|scroll
logicseparateseparate|common
show_author_filter00|1
show_date_filter00|1
show_sort10|1
collapsible00|1
show_thumbnail10|1
fallback_image—URL
show_author_meta00|1
show_date_meta00|1
date_formatd-m-YPHP date string
rtl00|1
exclude—5,10,23
include—1,2,3
exclude_category—3,8,12
include_category—1,4,7