added prefix tainacan in functions, options, variable and others

This commit is contained in:
Fabiano 2018-10-03 11:13:26 -03:00
parent 24faf62287
commit 1469c28e0a
8 changed files with 30 additions and 33 deletions

View File

@ -8,10 +8,10 @@
<main role="main" class="mt-5 max-large margin-one-column"> <main role="main" class="mt-5 max-large margin-one-column">
<div class="row"> <div class="row">
<div class="col-12 <?php if ( is_active_sidebar( 'sidebar-right' ) ) { ?>col-lg-9<?php } ?>"> <div class="col-12 <?php if ( is_active_sidebar( 'tainacan-sidebar-right' ) ) { ?>col-lg-9<?php } ?>">
<?php get_template_part( 'template-parts/loop' ); ?> <?php get_template_part( 'template-parts/loop' ); ?>
</div> </div>
<?php if ( is_active_sidebar( 'sidebar-right' ) ) { get_sidebar(); } ?> <?php if ( is_active_sidebar( 'tainacan-sidebar-right' ) ) { get_sidebar(); } ?>
</div> </div>
</main> </main>
<?php get_footer(); <?php get_footer();

View File

@ -1,10 +1,10 @@
<?php if ( ! is_404() ) : ?> <?php if ( ! is_404() ) : ?>
<footer class="container-fluid p-4 p-sm-5 mt-5 tainacan-footer" style="padding-bottom: 0 !important;"> <footer class="container-fluid p-4 p-sm-5 mt-5 tainacan-footer" style="padding-bottom: 0 !important;">
<?php if ( is_active_sidebar( 'footer-1' ) ) { ?> <?php if ( is_active_sidebar( 'tainacan-sidebar-footer' ) ) { ?>
<div class="row"> <div class="row">
<div class="col-12 col-lg"> <div class="col-12 col-lg">
<ul class="p-4 d-lg-flex justify-content-md-center mb-md-0"> <ul class="p-4 d-lg-flex justify-content-md-center mb-md-0">
<?php dynamic_sidebar( 'footer-1' ); ?> <?php dynamic_sidebar( 'tainacan-sidebar-footer' ); ?>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -94,7 +94,7 @@ if ( ! isset( $content_width ) ) {
function tainacan_widgets_sidebar_init() { function tainacan_widgets_sidebar_init() {
register_sidebar( array( register_sidebar( array(
'name' => __( 'Tainacan Sidebar Right', 'tainacan-interface' ), 'name' => __( 'Tainacan Sidebar Right', 'tainacan-interface' ),
'id' => 'sidebar-right', 'id' => 'tainacan-sidebar-right',
'before_widget' => '<aside id="%1$s" class="pb-4 pl-4 widget %2$s">', 'before_widget' => '<aside id="%1$s" class="pb-4 pl-4 widget %2$s">',
'after_widget' => '</aside>', 'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title font-weight-bold">', 'before_title' => '<h2 class="widget-title font-weight-bold">',
@ -109,7 +109,7 @@ add_action( 'widgets_init', 'tainacan_widgets_sidebar_init' );
function tainacan_widgets_footer_init() { function tainacan_widgets_footer_init() {
register_sidebar( array( register_sidebar( array(
'name' => __( 'Tainacan Sidebar Footer', 'tainacan-interface' ), 'name' => __( 'Tainacan Sidebar Footer', 'tainacan-interface' ),
'id' => 'footer-1', 'id' => 'tainacan-sidebar-footer',
'before_widget' => '<li class="border-left-0 border-right-0 tainacan-side"><input type="checkbox" checked><i></i>', 'before_widget' => '<li class="border-left-0 border-right-0 tainacan-side"><input type="checkbox" checked><i></i>',
'after_widget' => '</li>', 'after_widget' => '</li>',
'before_title' => '<h6 class="text-white font-weight-bold mb-lg-4">', 'before_title' => '<h6 class="text-white font-weight-bold mb-lg-4">',

View File

@ -2,8 +2,8 @@
class TainacanThemeCollectionColor { class TainacanThemeCollectionColor {
public $background_color = 'tainacan_theme_collection_background_color'; public $tainacan_background_color = 'tainacan_theme_collection_background_color';
public $text_color = 'tainacan_theme_collection_color'; public $tainacan_text_color = 'tainacan_theme_collection_color';
function __construct() { function __construct() {
add_filter( 'tainacan-api-response-collection-meta', array( $this, 'add_meta_to_response' ), 10, 2 ); add_filter( 'tainacan-api-response-collection-meta', array( $this, 'add_meta_to_response' ), 10, 2 );
@ -64,7 +64,7 @@ class TainacanThemeCollectionColor {
</span> </span>
<div class="control is-clearfix"> <div class="control is-clearfix">
<p style="font-weight: 600;"><?php _e( 'Picker color', 'tainacan-interface' ); ?></p> <p style="font-weight: 600;"><?php _e( 'Picker color', 'tainacan-interface' ); ?></p>
<input type="text" value="" id="colorpicker" name="<?php echo $this->background_color; ?>"> <input type="text" value="" id="colorpicker" name="<?php echo $this->tainacan_background_color; ?>">
</div> </div>
</div> </div>
@ -89,13 +89,13 @@ class TainacanThemeCollectionColor {
<input <input
type="radio" type="radio"
value="#fff" value="#fff"
name="<?php echo $this->text_color; ?>" name="<?php echo $this->tainacan_text_color; ?>"
id="white" checked> id="white" checked>
<label for="white" id="color-white" class="color-text"><?php _e( 'White', 'tainacan-interface' ); ?></label> <label for="white" id="color-white" class="color-text"><?php _e( 'White', 'tainacan-interface' ); ?></label>
<input <input
type="radio" type="radio"
value="#000" value="#000"
name="<?php echo $this->text_color; ?>" name="<?php echo $this->tainacan_text_color; ?>"
id="black"> id="black">
<label for="black" id="color-black" class="color-text"><?php _e( 'Black', 'tainacan-interface' ); ?></label> <label for="black" id="color-black" class="color-text"><?php _e( 'Black', 'tainacan-interface' ); ?></label>
</div> </div>
@ -109,8 +109,8 @@ class TainacanThemeCollectionColor {
function add_meta_to_response( $extra_meta, $request ) { function add_meta_to_response( $extra_meta, $request ) {
$extra_meta = array( $extra_meta = array(
$this->background_color, $this->tainacan_background_color,
$this->text_color, $this->tainacan_text_color,
); );
return $extra_meta; return $extra_meta;
} }
@ -123,11 +123,11 @@ class TainacanThemeCollectionColor {
$post = tainacan_get_api_postdata(); $post = tainacan_get_api_postdata();
if ( $object->can_edit() ) { if ( $object->can_edit() ) {
if ( isset( $post->{$this->background_color} ) ) { if ( isset( $post->{$this->tainacan_background_color} ) ) {
update_post_meta( $object->get_id(), $this->background_color, $post->{$this->background_color} ); update_post_meta( $object->get_id(), $this->tainacan_background_color, $post->{$this->tainacan_background_color} );
} }
if ( isset( $post->{$this->text_color} ) ) { if ( isset( $post->{$this->tainacan_text_color} ) ) {
update_post_meta( $object->get_id(), $this->text_color, $post->{$this->text_color} ); update_post_meta( $object->get_id(), $this->tainacan_text_color, $post->{$this->tainacan_text_color} );
} }
} }

View File

@ -76,7 +76,7 @@ function tainacan_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'display_powered', array( $wp_customize->add_setting( 'display_powered', array(
'default' => true, 'default' => true,
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'display_callback_sanitize_checkbox', 'sanitize_callback' => 'tainacan_display_callback_sanitize_checkbox',
) ); ) );
$wp_customize->add_control( 'display_powered', array( $wp_customize->add_control( 'display_powered', array(
@ -100,7 +100,7 @@ function tainacan_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'facebook_share', array( $wp_customize->add_setting( 'facebook_share', array(
'default' => true, 'default' => true,
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'display_callback_sanitize_checkbox', 'sanitize_callback' => 'tainacan_display_callback_sanitize_checkbox',
) ); ) );
$wp_customize->add_control( 'facebook_share', array( $wp_customize->add_control( 'facebook_share', array(
@ -115,7 +115,7 @@ function tainacan_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'twitter_share', array( $wp_customize->add_setting( 'twitter_share', array(
'default' => true, 'default' => true,
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'display_callback_sanitize_checkbox', 'sanitize_callback' => 'tainacan_display_callback_sanitize_checkbox',
) ); ) );
$wp_customize->add_control( 'twitter_share', array( $wp_customize->add_control( 'twitter_share', array(
@ -141,7 +141,7 @@ function tainacan_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'google_share', array( $wp_customize->add_setting( 'google_share', array(
'default' => true, 'default' => true,
'capability' => 'edit_theme_options', 'capability' => 'edit_theme_options',
'sanitize_callback' => 'display_callback_sanitize_checkbox', 'sanitize_callback' => 'tainacan_display_callback_sanitize_checkbox',
) ); ) );
$wp_customize->add_control( 'google_share', array( $wp_customize->add_control( 'google_share', array(
@ -205,7 +205,7 @@ add_action( 'customize_register', 'tainacan_customize_register', 11 );
* Callback to Checkbox to display or no the * Callback to Checkbox to display or no the
* Proudly Powered by Wordpress and Tainacan. * Proudly Powered by Wordpress and Tainacan.
*/ */
function display_callback_sanitize_checkbox( $checked ) { function tainacan_display_callback_sanitize_checkbox( $checked ) {
// Boolean check. // Boolean check.
return ( ( isset( $checked ) && true == $checked ) ? true : false ); return ( ( isset( $checked ) && true == $checked ) ? true : false );
} }

View File

@ -50,10 +50,10 @@ function tainacan_comments_callback( $comment, $args, $depth ) {
</div> </div>
<?php } <?php }
function wrap_comment( $content ) { function tainacan_wrap_comment( $content ) {
return '<div class="comment-text">' . $content . '</div>'; return '<div class="comment-text">' . $content . '</div>';
} }
add_filter( 'comment_text', 'wrap_comment', 99 ); add_filter( 'comment_text', 'tainacan_wrap_comment', 99 );
/** /**
* Display date of post. * Display date of post.
@ -80,12 +80,12 @@ function tainacan_meta_date_author( $echo = true ) {
} }
// define the cancel_comment_reply_link callback // define the cancel_comment_reply_link callback
function filter_cancel_comment_reply_link( $formatted_link, $link, $text ) { function tainacan_filter_cancel_comment_reply_link( $formatted_link, $link, $text ) {
// make filter magic happen here... // make filter magic happen here...
$formatted_link = '<a rel="nofollow" class="btn btn-info text-haiti bg-white border-oslo-gray align-self-center mt-3 ml-auto mr-1" id="cancel-comment-reply-link" href="' . $link . '" style="display:none;">' . $text . '</a>'; $formatted_link = '<a rel="nofollow" class="btn btn-info text-haiti bg-white border-oslo-gray align-self-center mt-3 ml-auto mr-1" id="cancel-comment-reply-link" href="' . $link . '" style="display:none;">' . $text . '</a>';
return $formatted_link; return $formatted_link;
} }
add_filter( 'cancel_comment_reply_link', 'filter_cancel_comment_reply_link', 10, 3 ); add_filter( 'cancel_comment_reply_link', 'tainacan_filter_cancel_comment_reply_link', 10, 3 );
function tainacan_social_meta() { function tainacan_social_meta() {
global $post; global $post;
@ -130,8 +130,7 @@ function tainacan_social_meta() {
<meta property="og:image:height" content="<?php echo $image['height']; ?>"/> <meta property="og:image:height" content="<?php echo $image['height']; ?>"/>
<?php <?php } else {
} else {
return; return;
} // End if(). } // End if().
} }

View File

@ -8,12 +8,10 @@
<main role="main" class="mt-5 max-large margin-one-column"> <main role="main" class="mt-5 max-large margin-one-column">
<div class="row"> <div class="row">
<div class="col-12 <?php if ( is_active_sidebar( 'sidebar-right' ) ) { ?>col-lg-9<?php } ?>"> <div class="col-12 <?php if ( is_active_sidebar( 'tainacan-sidebar-right' ) ) { ?>col-lg-9<?php } ?>">
<?php get_template_part( 'template-parts/loop' ); ?> <?php get_template_part( 'template-parts/loop' ); ?>
</div> </div>
<?php if ( is_active_sidebar( 'sidebar-right' ) ) { <?php if ( is_active_sidebar( 'tainacan-sidebar-right' ) ) { get_sidebar(); } ?>
get_sidebar();
} ?>
</div> </div>
</main> </main>
<?php get_footer(); <?php get_footer();

View File

@ -1,5 +1,5 @@
<div class="col-12 col-lg-3 border-top border-jelly-bean sidebar-border"> <div class="col-12 col-lg-3 border-top border-jelly-bean sidebar-border">
<div id="sidebar" class="py-4 pt-md-0 mx-2 mx-sm-0 sidebar hidden-print"> <div id="sidebar" class="py-4 pt-md-0 mx-2 mx-sm-0 sidebar hidden-print">
<?php dynamic_sidebar( 'sidebar-right' ); ?> <?php dynamic_sidebar( 'tainacan-sidebar-right' ); ?>
</div> </div>
</div> </div>