Skip to content

Instantly share code, notes, and snippets.

@marcusig
Created October 12, 2021 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusig/18b785ae148f08ebe9c78b7fa72c1b9c to your computer and use it in GitHub Desktop.
Save marcusig/18b785ae148f08ebe9c78b7fa72c1b9c to your computer and use it in GitHub Desktop.
Override the current Configurator theme using a postmeta
<?php
if ( ! defined( 'ABSPATH' ) ) die();
add_filter( 'mkl/pc/theme_id', function( $default ) {
global $post;
if ( ! is_a( $post, 'WP_Post' ) ) return $default;
// Example 1: use the post meta to get the theme
if ( get_post_meta( $post->ID, 'mkl_custom_page_theme', true ) ) return get_post_meta( $post->ID, 'mkl_custom_page_theme', true );
// Example 2: Check the current post ID to decide which theme to use
// if ( 349 === $post->ID ) return 'float';
return $default;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment