commit a7972c801393363ea0cce701ebcac2db60ff7155 Author: max/sooulix Date: Mon Jul 7 07:56:47 2025 +0200 initial commit diff --git a/art_portfolio_posts.php b/art_portfolio_posts.php new file mode 100644 index 0000000..6fba0bc --- /dev/null +++ b/art_portfolio_posts.php @@ -0,0 +1,68 @@ + 'Art Portfolio Posts', +# 'labels' => array( +# 'name' => 'Art Portfolio Experience', +# ), +# 'public' => true, +# 'support' => array( +# 'title', +# 'author', +# 'thumbnail', +# 'custom-fields' +# ) +# +# ) +# ); +# } +# +# # add_action('init', 'art_portfolio_posts_type'); +# +# # add_action('customize_register', 'front_page_portfolio'); +# function front_page_portfolio($wp_customize) { +# $wp_customize->add_setting('front_page_post_type', array( +# 'type' => 'option', +# 'capability' => 'manage_options', +# 'default' => 'post' +# )); +# $wp_customize->add_control( +# 'front_page_post_type', +# array( +# 'label' => '' +# ) +# +# } +# +add_filter('pre_get_posts', 'front_page_portfolio'); +function front_page_portfolio($query) { + $cat = isset($_GET['cat']) ? $_GET['cat'] : null; + $post_id = isset($_GET['post_id']) ? $_GET['post_id'] : null; + + if ($query->is_main_query() ) { + $query->set('post_type', 'art-experience'); + if (!empty($post_id)) { + $query->set('p', $post_id); + } + else if (!empty($cat)) { + $query->set('cat', $cat); + } + } +}