Skip to content

Instantly share code, notes, and snippets.

@nucklearproject
Created September 19, 2016 13:17
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 nucklearproject/a545d96d0f1c1270af102ad21fc7b443 to your computer and use it in GitHub Desktop.
Save nucklearproject/a545d96d0f1c1270af102ad21fc7b443 to your computer and use it in GitHub Desktop.
Base para Genesis framework
<?php
function be_megasense_defaults($defaults)
{
$defaults['ad_post_align'] = 'left';
$defaults['disquss-name'] = '';
$defaults['facebook-appid'] = '';
$defaults['default-comment'] = 'default';
$default['show_author'] = '1';
$default['show_share'] = '1';
$default['show_header'] = '1';
$default['copyright'] = '';
$default['noshowcategoryid'] = '';
$default['link_to_author'] = '1';
$default['add_in_category'] = '';
return $defaults;
}
add_filter('genesis_theme_settings_defaults', 'be_megasense_defaults');
/**
* Sanitization
* @author Bill Erickson
* @link http://www.billerickson.net/genesis-theme-options/
*
*/
function megasense_social_sanitization_filters()
{
/*
one_zero: Same as true-false
no_html: Does not allow for any HTML
safe_html: Removes unsafe HTML via wp_kses_post()
requires_unfiltered_html: Keeps the option from being updated if the user lacks unfiltered_html capability
*/
genesis_add_option_filter('requires_unfiltered_html', GENESIS_SETTINGS_FIELD, array(
'ad-post-align',
'disquss-name',
'facebook-appid',
'default-comment',
'show_author',
'copyright',
'noshowcategoryid',
'link_to_author',
'add_in_category',
));
}
/**
* Register Metabox
* @author Bill Erickson
* @link http://www.billerickson.net/genesis-theme-options/
*
* @param string $_genesis_theme_settings_pagehook
*/
function theming_settings_box($_genesis_theme_settings_pagehook)
{
add_meta_box('mytheme-settings', 'Theme options', 'mytheme_settings_box', $_genesis_theme_settings_pagehook, 'main', 'high');
}
add_action('genesis_theme_settings_metaboxes', 'theming_settings_box');
/**
* Create Metabox
* @author Bill Erickson
* @link http://www.billerickson.net/genesis-theme-options/
*
*/
function mytheme_settings_box()
{
?>
<h4>Special conf</h4>
<p>Ad inner post align(Adaptive ad widget)<br/>
<select name="<?php echo GENESIS_SETTINGS_FIELD; ?>[ad-post-align]">
<option value="left" <?php selected(genesis_get_option('ad-post-align'), 'left') ?>>Left</option>
<option value="right" <?php selected(genesis_get_option('ad-post-align'), 'right') ?>>Right</option>
</select>
<p>Mostrar sistema de comentarios<br/>
<select name="<?php echo GENESIS_SETTINGS_FIELD; ?>[default-comment]">
<option value="default" <?php selected(genesis_get_option('default-comment'), 'default') ?>>Default WP</option>
<option value="disquss" <?php selected(genesis_get_option('default-comment'), 'disquss') ?>>Disquss comments
</option>
<option value="facebook" <?php selected(genesis_get_option('default-comment'), 'facebook') ?>>Facebook comments
</option>
</select>
<p>Comentarios disquss(Ingrese el nombre de tu foro disquss - Necesario para usar los comentarios)<br/>
<input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[disquss-name]"
value="<?php echo esc_attr(genesis_get_option('disquss-name')); ?>" size="60"/></p>
<p>Comentarios Facebook(Ingresa tu Facebook ID - Necesario para usar los comentarios)<br/>
<input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[facebook-appid]"
value="<?php echo esc_attr(genesis_get_option('facebook-appid')); ?>" size="60"/></p>
<p>
<input type="checkbox" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[show_author]"
value="1" <?php checked('1', genesis_get_option('show_author')); ?> />Mostrar el author en cada post.</p>
<input type="checkbox" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[link_to_author]"
value="1" <?php checked('1', genesis_get_option('link_to_author')); ?> />Mostrar el link a los post de author</p>
<p>
<input type="checkbox" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[show_header]"
value="1" <?php checked('1', genesis_get_option('show_header')); ?> />Mostrar header en cada categoría(Header line y Parrafo
<a href="http://i.imgur.com/45ey326.png" target="_blank"/>Imagen</a>)
</p>
<p>Si muestras el parrafo en el header de cada categoria, ingresa tu ad de publicidad.<br/>
<textarea cols="60" rows="3"
name="<?php echo GENESIS_SETTINGS_FIELD; ?>[add_in_category]"><?php echo genesis_get_option('add_in_category'); ?></textarea>
</p>
<p>Footer copyright text(Let blank for default)<br/>
<textarea cols="60" rows="3"
name="<?php echo GENESIS_SETTINGS_FIELD; ?>[copyright]"><?php echo genesis_get_option('copyright'); ?></textarea>
</p>
<p>No mostrar las siguientes categorias en la pagina "blog" y el widget Megasense featured post Ejm -4, -1<br/>
<input type="text" name="<?php echo GENESIS_SETTINGS_FIELD; ?>[noshowcategoryid]"
value="<?php echo esc_attr(genesis_get_option('noshowcategoryid')); ?>" size="60"/></p>
<?php }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment