Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter lazy_entrepreneur

    (@lazy_entrepreneur)

    Hi Michael.

    There is a Genesis class which is useful. Try – “Genesis_Admin_Boxes”.
    Ref: https://designsbynickthegeek.com/tutorials/your-first-plugin

    I did some testing with the below code, switching between themes, and all seemed to work well.

    <?php if ( is_admin() && class_exists( 'Genesis_Admin_Boxes' ) ) { ?>
    
    <input type="checkbox" name="cpt_supports[]" tabindex="21" value="genesis-cpt-archives-settings" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('genesis-cpt-archives-settings', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; }  ?> />&nbsp;<?php _e( 'Genesis CPT Archives Settings' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds Genesis CPT Archives Settings', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
    
    <input type="checkbox" name="cpt_supports[]" tabindex="21" value="genesis-seo" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('genesis-seo', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; }  ?> />&nbsp;<?php _e( 'Genesis SEO' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds Genesis SEO', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
    
    <input type="checkbox" name="cpt_supports[]" tabindex="21" value="genesis-layouts" <?php if (isset($cpt_supports) && is_array($cpt_supports)) { if (in_array('genesis-layouts', $cpt_supports)) { echo 'checked="checked"'; } } elseif (!isset($_GET['edittype'])) { echo 'checked="checked"'; }  ?> />&nbsp;<?php _e( 'Genesis layouts' , 'cpt-plugin' ); ?> <a href="#" title="<?php esc_attr_e( 'Adds Genesis layouts', 'cpt-plugin' ); ?>" class="help">?</a> <br/ >
    
    <?php } ?>

    Regards,
    W

    Thread Starter lazy_entrepreneur

    (@lazy_entrepreneur)

    Ok … I’ve simplified the code. This now seems to work every time.
    If anyone is copying this, don’t forget to go to:
    Settings -> Permalinks -> Common Settings … set to “Post Names”.

    // Selects Custom Post Type Templates for single and archive pages
    // ----------------------------------------------------------------------
    add_filter('template_include', 'custom_template_include');
    function custom_template_include($template) {
    	$custom_template_location = '/my-inc/my-templates/';
         if ( get_post_type () ) {
            if ( is_archive() ) :
               if(file_exists(get_stylesheet_directory() . $custom_template_location . 'archive-' . get_post_type() . '.php'))
                  return get_stylesheet_directory() . $custom_template_location . 'archive-' . get_post_type() . '.php';
            endif;
            if ( is_single() ) :
               if(file_exists(get_stylesheet_directory() . $custom_template_location . 'single-' . get_post_type() . '.php'))
                  return get_stylesheet_directory() . $custom_template_location . 'single-' . get_post_type() . '.php';
            endif;
        }
        return $template;
      }
    Thread Starter lazy_entrepreneur

    (@lazy_entrepreneur)

    It seems the Plugin is smart enough to re-size the map to fit all the pins, but with a comfortable margin around the sides. A quick change to the output height of the map and things look perfect.

Viewing 3 replies - 1 through 3 (of 3 total)