Filter posts on new page

You can do this with a combination of rewrite endpoints and the pre_get_posts action. First, your taxonomy has to be registered with some specific rewrite arguments to enable this, particularly, ep_mask: register_taxonomy( ‘customtax’, ‘posttype’, array( ‘rewrite’ => array( ‘slug’ => ‘custom-tax’, ‘hierarchical’ => true, ‘ep_mask’ => EP_ALL ), // other args… ) ); You can … Read more

Get shortcode attribute value to another function

<?php class MakeShortcode { public $color; public function __construct() { add_action( ‘init’, array($this, ‘PostBLock’) ); add_shortcode( ‘PostBLock’, array($this, ‘getpostblock’) ); add_action( ‘wp_enqueue_scripts’, array( $this, ‘inlinestyle’) ); } public function getpostblock( $atts ){ extract( shortcode_atts( array( ‘section_color’ => ‘#000000’, ), $atts) ); return $section_color; } public function inlinestyle(){ $color = $this->getpostblock(); wp_enqueue_style( ‘custom-style’, get_template_directory_uri() . ‘/css/style.css’ … Read more