initial commit

This commit is contained in:
max/sooulix 2025-07-07 07:56:47 +02:00
commit a7972c8013

68
art_portfolio_posts.php Normal file
View File

@ -0,0 +1,68 @@
<?php
/**
* @package Art_Portfolio Posts
* @version 0.0.1
*/
/*
Plugin Name: Art Portfolio Posts
Plugin URI: https://www.freepoteries.fr
Description: Standardize posts for portfolios
Author: Ms. Leave A Mix
Version: 0.0.1
Author URI: https://www.freepoteries.fr
*/
if (!defined('ABSPATH')) { die(); }
# function art_portfolio_posts_type() {
# register_post_type(
# 'art_portfolio_post',
# array(
# 'label' => '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);
}
}
}