Move into wp-content path
Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
143
wp-content/themes/Pirate-Rogue/inc/custom-fields.php
Normal file
143
wp-content/themes/Pirate-Rogue/inc/custom-fields.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Custom Fields
|
||||
* Metaboxes and adjustments for generell custom fields
|
||||
*/
|
||||
|
||||
|
||||
add_action( 'load-post.php', 'pirate_rogue_metabox_cf_setup' );
|
||||
add_action( 'load-post-new.php', 'pirate_rogue_metabox_cf_setup' );
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Meta box setup function.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_metabox_cf_setup() {
|
||||
|
||||
add_action( 'add_meta_boxes', 'pirate_rogue_add_metabox_posts' );
|
||||
add_action( 'add_meta_boxes', 'pirate_rogue_add_metabox_pages' );
|
||||
|
||||
/* Save subtitle */
|
||||
add_action( 'save_post', 'pirate_rogue_save_metabox_attributes', 10, 2 );
|
||||
|
||||
/* Save Page Sidebar */
|
||||
add_action( 'save_post', 'pirate_rogue_save_metabox_page_sidebar', 10, 2 );
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Create one or more meta boxes to be displayed on the post editor screen.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_add_metabox_posts() {
|
||||
|
||||
/* Subtitle */
|
||||
add_meta_box(
|
||||
'pirate_rogue_metabox_attributes',
|
||||
esc_html__( 'Attributes', 'pirate-rogue' ),
|
||||
'pirate_rogue_do_metabox_attributes',
|
||||
'post','normal','high'
|
||||
);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Create one or more meta boxes to be displayed on the post editor screen.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_add_metabox_pages() {
|
||||
/* None yet */
|
||||
add_meta_box(
|
||||
'pirate_rogue_metabox_page_sidebar',
|
||||
esc_html__( 'Sidebar', 'pirate-rogue' ),
|
||||
'pirate_rogue_do_metabox_page_sidebar',
|
||||
'page','normal','core'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Display metabox in pages for sidebar
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_do_metabox_page_sidebar( $object, $box ) {
|
||||
wp_nonce_field( basename( __FILE__ ), 'pirate_rogue_metabox_page_sidebar_nonce' );
|
||||
$post_type = get_post_type( $object->ID);
|
||||
|
||||
if ( 'post' == $post_type ) {
|
||||
if ( !current_user_can( 'edit_post', $object->ID) )
|
||||
return;
|
||||
} elseif ('page' == $post_type ) {
|
||||
if ( !current_user_can( 'edit_page', $object->ID) )
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
$pirate_rogue_page_sidebar = get_post_meta( $object->ID, 'pirate_rogue_page_sidebar', true );
|
||||
pirate_rogue_form_wpeditor('pirate_rogue_page_sidebar', $pirate_rogue_page_sidebar, __('Content','pirate-rogue'), __('Optional entries for the sidebar','pirate-rogue'), false);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Save the meta box page sidebar data
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_save_metabox_page_sidebar( $post_id, $post ) {
|
||||
/* Verify the nonce before proceeding. */
|
||||
if ( !isset( $_POST['pirate_rogue_metabox_page_sidebar_nonce'] ) || !wp_verify_nonce( $_POST['pirate_rogue_metabox_page_sidebar_nonce'], basename( __FILE__ ) ) )
|
||||
return $post_id;
|
||||
|
||||
|
||||
/* Check if the current user has permission to edit the post. */
|
||||
if ( !current_user_can( 'edit_page', $post_id ) )
|
||||
return;
|
||||
pirate_rogue_save_standard('pirate_rogue_page_sidebar', $_POST['pirate_rogue_page_sidebar'], $post_id, 'page', 'wpeditor');
|
||||
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Display Options for subtitles on posts
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_do_metabox_attributes( $object, $box ) {
|
||||
wp_nonce_field( basename( __FILE__ ), 'pirate_rogue_metabox_attributes_nonce' );
|
||||
$post_type = get_post_type( $object->ID);
|
||||
|
||||
if ( 'post' == $post_type ) {
|
||||
if ( !current_user_can( 'edit_post', $object->ID) )
|
||||
return;
|
||||
} elseif ('page' == $post_type ) {
|
||||
if ( !current_user_can( 'edit_page', $object->ID) )
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
$piratenkleider_untertitel = get_post_meta( $object->ID, 'piratenkleider_subtitle', true );
|
||||
$untertitel = get_post_meta( $object->ID, 'pirate_rogue_subtitle', true );
|
||||
if ((empty($untertitel)) && (isset($piratenkleider_untertitel))) {
|
||||
$untertitel = $piratenkleider_untertitel;
|
||||
}
|
||||
pirate_rogue_form_text('pirate_rogue_metabox_untertitel', $untertitel, __('Subtitle','pirate-rogue'), __('Enter a text for a subtitle here, which belongs to the main title of the entry. Do not use more than 120 characters.','pirate-rogue'));
|
||||
|
||||
$canonical = get_post_meta( $object->ID, 'pirate_rogue_canonical', true );
|
||||
pirate_rogue_form_url('pirate_rogue_metabox_canonical', $canonical, __('URL (original address)','pirate-rogue'), __('Enter the URL of the original post where the text has been taken from. This could be another blog or website.','pirate-rogue'));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Save the meta box's post/page metadata.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_save_metabox_attributes( $post_id, $post ) {
|
||||
/* Verify the nonce before proceeding. */
|
||||
if ( !isset( $_POST['pirate_rogue_metabox_attributes_nonce'] ) || !wp_verify_nonce( $_POST['pirate_rogue_metabox_attributes_nonce'], basename( __FILE__ ) ) )
|
||||
return $post_id;
|
||||
|
||||
|
||||
/* Check if the current user has permission to edit the post. */
|
||||
if ( !current_user_can( 'edit_post', $post_id ) )
|
||||
return;
|
||||
|
||||
|
||||
$piratenkleider_untertitel = get_post_meta( $post_id, 'piratenkleider_subtitle', true );
|
||||
if ($piratenkleider_untertitel) {
|
||||
delete_post_meta( $post_id, 'piratenkleider_subtitle', $piratenkleider_untertitel );
|
||||
}
|
||||
pirate_rogue_save_standard('pirate_rogue_subtitle', $_POST['pirate_rogue_metabox_untertitel'], $post_id, 'text');
|
||||
pirate_rogue_save_standard('pirate_rogue_canonical', $_POST['pirate_rogue_metabox_canonical'], $post_id, 'url');
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Beim Klabautermann! Da is ja nix mehr!
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
70
wp-content/themes/Pirate-Rogue/inc/custom-header.php
Normal file
70
wp-content/themes/Pirate-Rogue/inc/custom-header.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Init custom header functions
|
||||
/* @link http://codex.wordpress.org/Custom_Headers
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_custom_header_setup() {
|
||||
$args = array(
|
||||
'default-image' => '',
|
||||
'default-text-color' => '2b2b2b',
|
||||
'width' => 1440,
|
||||
'height' => 530,
|
||||
'flex-width' => false,
|
||||
'flex-height' => true,
|
||||
'wp-head-callback' => 'pirate_rogue_header_style',
|
||||
);
|
||||
|
||||
add_theme_support( 'custom-header', $args );
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'pirate_rogue_custom_header_setup');
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Style the header text displayed on the blog.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_header_style() {
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Own Custom Logo function to get logo without link on startpage and with defined classes
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_get_custom_logo' ) ) :
|
||||
function pirate_rogue_get_custom_logo($imgclass='custom-logo', $linkclass = 'custom-logo-link', $linktitle='') {
|
||||
$html = '';
|
||||
$switched_blog = false;
|
||||
$blog_id = 0;
|
||||
|
||||
$custom_logo_id = get_theme_mod( 'custom_logo' );
|
||||
if ( $custom_logo_id ) {
|
||||
$html = '<a';
|
||||
if ( !is_front_page() ) {
|
||||
$html .= ' href="'.esc_url( home_url( '/' ) ).'"';
|
||||
$html .= ' rel="home"';
|
||||
}
|
||||
if (!empty($linkclass)) {
|
||||
$html .= ' class="'.$linkclass.'"';
|
||||
}
|
||||
if (!empty($linktitle)) {
|
||||
$html .= ' title="'.$linktitle.'"';
|
||||
}
|
||||
$html .= '>';
|
||||
$html .= wp_get_attachment_image( $custom_logo_id, 'full', false, array(
|
||||
'class' => $imgclass
|
||||
) );
|
||||
|
||||
|
||||
$html .= '</a>';
|
||||
} elseif ( is_customize_preview() ) {
|
||||
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
|
||||
$html = sprintf( '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo"/></a>',
|
||||
esc_url( home_url( '/' ) )
|
||||
);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
endif;
|
||||
924
wp-content/themes/Pirate-Rogue/inc/defaults.php
Normal file
924
wp-content/themes/Pirate-Rogue/inc/defaults.php
Normal file
@@ -0,0 +1,924 @@
|
||||
<?php
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Default values
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
$pagebreakargs = array(
|
||||
'before' => '<div class="page-links"><span class="pagination-title">' . __("Seite:", 'pirate-rogue'). '</span>',
|
||||
'after' => '</div>',
|
||||
'link_before' => '<span class="number">',
|
||||
'link_after' => '</span>',
|
||||
'next_or_number' => 'number',
|
||||
'separator' => ' ',
|
||||
'nextpagelink' => __( 'Next page', 'pirate-rogue' ),
|
||||
'previouspagelink' => __( 'Previous page', 'pirate-rogue' ),
|
||||
'pagelink' => '%',
|
||||
'echo' => 0
|
||||
);
|
||||
|
||||
|
||||
// Default Colors
|
||||
// Notice: This list must match with the SASS-Colorset in css/sass/variables.scss !!!
|
||||
$default_colorlist = array(
|
||||
'main' => '#ff8800',
|
||||
'second' => '#672082',
|
||||
'third' => '#698bc1',
|
||||
'four' => '#148f93',
|
||||
'uspirates' => '#B127AF',
|
||||
'tkpirates' => '#00B5B1',
|
||||
'chpirates' => '#F9B200',
|
||||
'ispirates' => '#51297e',
|
||||
|
||||
'black' => '#000',
|
||||
'white' => '#fff',
|
||||
'grey' => '#e7e7eb',
|
||||
'darkgrey' => '#1a1a1a',
|
||||
'blue' => '#0066ff',
|
||||
'red' => '#d7464d',
|
||||
'yellow' => '#e7b547',
|
||||
'green' => '#85c066'
|
||||
);
|
||||
|
||||
// Options for Customizer
|
||||
// @since 1.2.14
|
||||
|
||||
$pirate_rogue_options = array(
|
||||
'pirate_rogue_themeoptions' => array(
|
||||
'tabtitle' => __('Theme Options', 'pirate-rogue'),
|
||||
'fields' => array(
|
||||
'pirate_rogue_section_images' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Default Images', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_fallback_thumbnail' => array(
|
||||
'type' => 'image',
|
||||
'title' => __( 'Fallback Thumbnail', 'pirate-rogue'),
|
||||
'label' => __( 'If thumbnail for a post is not available, use this thumbnail as a fallback.', 'pirate-rogue'),
|
||||
'flex_width' => true, // Allow any width, making the specified value recommended. False by default.
|
||||
'flex_height' => false, // Require the resulting image to be exactly as tall as the height attribute (default).
|
||||
'width' => 1260,
|
||||
'height' => 709,
|
||||
'parent' => 'pirate_rogue_section_images'
|
||||
),
|
||||
'pirate_rogue_fallback_blogroll_thumbnail' => array(
|
||||
'type' => 'image',
|
||||
'title' => __( 'Fallback Thumbnail For Blogroll', 'pirate-rogue'),
|
||||
'label' => __( 'If thumbnail for a post is not available, use this thumbnail as a fallback for normal blogroll.', 'pirate-rogue'),
|
||||
'flex_width' => true, // Allow any width, making the specified value recommended. False by default.
|
||||
'flex_height' => false, // Require the resulting image to be exactly as tall as the height attribute (default).
|
||||
'width' => 1024,
|
||||
'height' => 576,
|
||||
'parent' => 'pirate_rogue_section_images'
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
'pirate_rogue_section_header' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Header', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_headerstyle'=> array(
|
||||
'type' => 'select',
|
||||
'title' => __( 'Header Image Style', 'pirate-rogue'),
|
||||
'label' => __( 'Choose the style you like to use for the header image.', 'pirate-rogue'),
|
||||
'liste' => array(
|
||||
'header-fullwidth' => __( 'Fullwidth', 'pirate-rogue'),
|
||||
'header-boxed' => __( 'Boxed', 'pirate-rogue'),
|
||||
'header-fullscreen' => __( 'Fullscreen', 'pirate-rogue'),
|
||||
),
|
||||
'default' => 'header-fullwidth',
|
||||
'parent' => 'pirate_rogue_section_header'
|
||||
|
||||
),
|
||||
'pirate_rogue_hidesearch' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Hide Search in Header', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_header'
|
||||
),
|
||||
'pirate_rogue_search_overlay_backgroundcolor'=> array(
|
||||
'type' => 'select',
|
||||
'title' => __( 'Search Background Style', 'pirate-rogue'),
|
||||
'label' => __( 'Choose the background color of the overlay search input.', 'pirate-rogue'),
|
||||
'liste' => array(
|
||||
'darkcolor' => __( 'Dark grey', 'pirate-rogue'),
|
||||
'maincolor' => __( 'Main color', 'pirate-rogue'),
|
||||
'secondcolor' => __( 'Second color', 'pirate-rogue'),
|
||||
),
|
||||
'default' => 'maincolor',
|
||||
'parent' => 'pirate_rogue_section_header'
|
||||
|
||||
),
|
||||
|
||||
|
||||
'pirate_rogue_socialmedia_style'=> array(
|
||||
'type' => 'select',
|
||||
'title' => __( 'Social Media Icon Style', 'pirate-rogue'),
|
||||
'label' => __( 'Choose the color of the social media icons (needs items added to menu in a Social Icons position). Notice: this will also change the color of the search icon and the hamburger overlay icon.', 'pirate-rogue'),
|
||||
'liste' => array(
|
||||
'colorful' => __( 'Colorful Social Media Icons', 'pirate-rogue'),
|
||||
'maincolor' => __( 'Use main color', 'pirate-rogue'),
|
||||
'secondcolor' => __( 'Use second color', 'pirate-rogue'),
|
||||
),
|
||||
'default' => 'colorful',
|
||||
'parent' => 'pirate_rogue_section_header'
|
||||
|
||||
),
|
||||
'pirate_rogue_fixedheader' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'No Fix-Positioned Header', 'pirate-rogue'),
|
||||
'label' => __( 'By default, the fix-positioned header is visible on wider screens, if the browser window is scrolled.', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_header'
|
||||
),
|
||||
'pirate_rogue_show_titleonlogo' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Always Show Title', 'pirate-rogue'),
|
||||
'label' => __( 'By default, the site title is hidden if logo is present.', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_header'
|
||||
),
|
||||
'pirate_rogue_show_labelonlogo' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Always Show Tagline', 'pirate-rogue'),
|
||||
'label' => __( 'By default, the site tagline is hidden if logo is present.', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_header'
|
||||
),
|
||||
|
||||
|
||||
'pirate_rogue_section_sidebar' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Sidebar', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_sidebar'=> array(
|
||||
'type' => 'select',
|
||||
'title' => __( 'Sidebar Position', 'pirate-rogue'),
|
||||
'liste' => array(
|
||||
'sidebar-right' => __( 'Right', 'pirate-rogue'),
|
||||
'sidebar-left' => __( 'Left', 'pirate-rogue'),
|
||||
),
|
||||
'default' => 'sidebar-right',
|
||||
'parent' => 'pirate_rogue_section_sidebar'
|
||||
|
||||
),
|
||||
'pirate_rogue_sidebar_hide'=> array(
|
||||
'type' => 'select',
|
||||
'title' => __( 'Sidebar Visibility', 'pirate-rogue'),
|
||||
'liste' => array(
|
||||
'sidebar-show' => __( 'Show sidebar', 'pirate-rogue'),
|
||||
'sidebar-no' => __( 'Hide sidebar', 'pirate-rogue'),
|
||||
'sidebar-no-single' => __( 'Hide sidebar on single posts', 'pirate-rogue'),
|
||||
'sidebar-no-front' => __( 'Hide sidebar on front page', 'pirate-rogue'),
|
||||
),
|
||||
'default' => 'sidebar-show',
|
||||
'parent' => 'pirate_rogue_section_sidebar'
|
||||
|
||||
),
|
||||
|
||||
'pirate_rogue_section_footer' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Footer', 'pirate-rogue'),
|
||||
),
|
||||
|
||||
'pirate_rogue_footerfeature_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Title', 'pirate-rogue'),
|
||||
'label' => __( 'This is a small title text visible at the top of the area.', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_customlogofooter' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Show Custom Logo', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_footerfeature_image' => array(
|
||||
'type' => 'image',
|
||||
'title' => __( 'Featured Image', 'pirate-rogue'),
|
||||
'width' => 800,
|
||||
'height'=> 450,
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_footerfeature_text_big'=> array(
|
||||
'type' => 'textarea',
|
||||
'title' => __( 'Big Text', 'pirate-rogue'),
|
||||
'label' => __( 'This big slogan text is shown next to the image (HTML is allowed).', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_footerfeature_text_small'=> array(
|
||||
'type' => 'textarea',
|
||||
'title' => __( 'Small Text', 'pirate-rogue'),
|
||||
'label' => __( 'This is an additional smaller description text shown below the big text (HTML is allowed).', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_footerfeature_btn_text'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Button Text', 'pirate-rogue'),
|
||||
'label' => __( 'If you want to add a "Call to Action" button, include the button text here.', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_footerfeature_btn_link'=> array(
|
||||
'type' => 'url',
|
||||
'title' => __( 'Button Link URL', 'pirate-rogue'),
|
||||
'label' => __( 'Enter the URL the button should link to.', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_footermenu_image' => array(
|
||||
'type' => 'image',
|
||||
'title' => __( 'Menu Footer Image', 'pirate-rogue'),
|
||||
'flex_width' => true, // Allow any width, making the specified value recommended. False by default.
|
||||
'flex_height' => true, // Require the resulting image to be exactly as tall as the height attribute (default).
|
||||
'width' => 800,
|
||||
'height' => 450,
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_footer_search' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Show Search', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
'pirate_rogue_credit'=> array(
|
||||
'type' => 'html',
|
||||
'title' => __( 'Credit Text', 'pirate-rogue'),
|
||||
'label' => __( 'Customize the footer credit text (HTML is allowed).', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_footer'
|
||||
),
|
||||
|
||||
|
||||
|
||||
'pirate_rogue_section_metadata' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Metadata and Global Settings', 'pirate-rogue'),
|
||||
),
|
||||
|
||||
'pirate_rogue_author'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Author', 'pirate-rogue'),
|
||||
'label' => __( 'This is the default author of posts used for structured data.', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_metadata'
|
||||
),
|
||||
'pirate_rogue_google_wmt_verification_text'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Google Site Verification', 'pirate-rogue'),
|
||||
'label' => __( 'For verification of your website as property owner at <a target="_blank" href="https://search.google.com/search-console">Google Search Console</a>, use the alternative method and copy the value of the attribute <b>content</b> of the given HTML tag. Insert this string here.<br>'
|
||||
. 'Example: if given <code><meta name="google-site-verification" content="BBssyCpddd8" /></code> then insert <code>BBssyCpddd8</code>.', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_metadata'
|
||||
),
|
||||
'pirate_rogue_devider_hideimage' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Hide Pirate Image On Dividers', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_metadata'
|
||||
),
|
||||
'pirate_rogue_shadow_images' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Add Shadow To Images', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_metadata'
|
||||
),
|
||||
'pirate_rogue_all_hideauthor' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Hide Author Names', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_metadata'
|
||||
),
|
||||
'pirate_rogue_h1noupper' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => esc_html__( 'Normal style for first headline', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_metadata'
|
||||
),
|
||||
|
||||
'pirate_rogue_section_comments' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Comments', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_hidecomments' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Show Comments Button', 'pirate-rogue'),
|
||||
'label' => __( 'This will hide comments below single posts. There will be a button to show the comments.', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_comments'
|
||||
),
|
||||
'pirate_rogue_commentdisclaimer'=> array(
|
||||
'type' => 'html',
|
||||
'title' => __( 'Comment Disclaimer', 'pirate-rogue'),
|
||||
'label' => __( 'Disclaimer is shown above the comment form (HTML is allowed).', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_comments'
|
||||
),
|
||||
'pirate_rogue_externcomments_active' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Link To External Board', 'pirate-rogue'),
|
||||
'label' => __( 'Show a link to an external discussion board which vistors can use instead of regular comments.', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_section_comments'
|
||||
),
|
||||
'pirate_rogue_externcomments_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' =>__( 'Link Text', 'pirate-rogue'),
|
||||
'label' => __( 'Enter the text for the link to the external board.', 'pirate-rogue'),
|
||||
'default' => __( 'Discuss this on our board', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_section_comments'
|
||||
),
|
||||
'pirate_rogue_externcomments_url'=> array(
|
||||
'type' => 'url',
|
||||
'title' => __( 'URL', 'pirate-rogue'),
|
||||
'label' => __( 'Enter the URL of the external board.', 'pirate-rogue'),
|
||||
'default' => 'https://forum.piratenpartei.de',
|
||||
'parent' => 'pirate_rogue_section_comments'
|
||||
),
|
||||
'pirate_rogue_section_misc' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Miscellaneous', 'pirate-rogue'),
|
||||
),
|
||||
|
||||
'pirate_rogue_section_coloroverwrite' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Colors', 'pirate-rogue'),
|
||||
'desc' => __( 'This will allow to change the default colors. Please notice, that the following color options use a fix list of predefined colors. To change the website to other colors, use "Custom CSS" option.', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_head_background_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Header Background', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_head_text_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Header Texts', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to site title and menu links in header, plus the search icon and the hamburger overlay icon.', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_head_linkhover_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Header Links (Hovered)', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to underlining of menu links in header, plus the search icon and the hamburger overlay icon.', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_actionbutton_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Action Buttons', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_background_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Main Background', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_headline_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Main Headlines', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to all headlines in main region.', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_text_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Main Texts', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_link_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Main Links', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_linkhover_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Main Links (Hovered)', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_titleunderline_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Title Underline', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to underlining of the page title.', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_listitem_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'List Items', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to bullets of unordered lists.', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_quoteborder_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Blockquote Borders', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_meta_bgcol' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Meta Links Backgrounds', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to meta links (e.g. tags and categories).', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_meta_bgcol_hover' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Meta Links Backgrounds (Hovered)', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to meta links (e.g. tags and categories).', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_meta_textcol' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Meta Links', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to meta links (e.g. tags and categories).', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_meta_textcol_hover' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Meta Links (Hovered)', 'pirate-rogue'),
|
||||
'label' => __( 'This applies to meta links (e.g. tags and categories).', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_table_textcol' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Tables', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_table_bgcol' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Table Backgrounds', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_table_bgcol_header' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Table Header Backgrounds', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_main_table_bgcol_oddrows' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Table Backgrounds (Odd Rows)', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_footer_background_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Footer Background', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_footer_headline_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Footer Headlines', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_footer_text_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Footer Texts', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_footer_link_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Footer Links', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
'pirate_rogue_footer_linkhover_color' => array(
|
||||
'type' => 'colorlist-radio',
|
||||
'title' => __( 'Footer Links (Hovered)', 'pirate-rogue'),
|
||||
'liste' => $default_colorlist,
|
||||
'parent' => 'pirate_rogue_section_coloroverwrite'
|
||||
),
|
||||
|
||||
|
||||
|
||||
'plugin_pirate_crew_setting' => array(
|
||||
'type' => 'section',
|
||||
'title' => __('Pirate Crew Settings', 'pirate-rogue'),
|
||||
|
||||
),
|
||||
'pirate_rogue_crewmember-title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Title', 'pirate-rogue'),
|
||||
'label' => __( 'Set a title to show above pirate crew member info panel.', 'pirate-rogue'),
|
||||
'parent' => 'plugin_pirate_crew_setting',
|
||||
'ifclass' => 'Pirate_Crew',
|
||||
),
|
||||
'pirate_rogue_crewmember-position'=> array(
|
||||
'title' => __( 'Position', 'pirate-rogue'),
|
||||
'label' => __( 'Set the position to show the pirate crew member card.', 'pirate-rogue'),
|
||||
'parent' => 'plugin_pirate_crew_setting',
|
||||
'ifclass' => 'Pirate_Crew',
|
||||
'default' => 'sidebar',
|
||||
'type' => 'select',
|
||||
'liste' => array(
|
||||
'sidebar' => __('Sidebar', 'pirate-rogue'),
|
||||
'content' => __('Content','pirate-rogue')
|
||||
),
|
||||
),
|
||||
'pirate_rogue_crewmember-style'=> array(
|
||||
'title' => __( 'Style', 'pirate-rogue'),
|
||||
'label' => __( 'Set the style of the pirate crew member card.', 'pirate-rogue'),
|
||||
'parent' => 'plugin_pirate_crew_setting',
|
||||
'ifclass' => 'Pirate_Crew',
|
||||
'default' => 'style3',
|
||||
'type' => 'select',
|
||||
'liste' => array(
|
||||
'style1' => sprintf(__('Style %d', 'pirate-rogue'), 1),
|
||||
'style2' => sprintf(__('Style %d', 'pirate-rogue'), 2),
|
||||
'style3' => sprintf(__('Style %d', 'pirate-rogue'), 3),
|
||||
'style4' => sprintf(__('Style %d', 'pirate-rogue'), 4),
|
||||
),
|
||||
),
|
||||
'pirate_rogue_crewmember-format'=> array(
|
||||
'title' => __( 'Format', 'pirate-rogue'),
|
||||
'label' => __( 'Set the format to show the pirate crew member card.', 'pirate-rogue'),
|
||||
'parent' => 'plugin_pirate_crew_setting',
|
||||
'ifclass' => 'Pirate_Crew',
|
||||
'default' => 'card',
|
||||
'type' => 'select',
|
||||
'liste' => array(
|
||||
'card' => __('Card', 'pirate-rogue'),
|
||||
'list' => __('List', 'pirate-rogue'),
|
||||
),
|
||||
),
|
||||
|
||||
)
|
||||
),
|
||||
'pirate_rogue_frontpage' => array(
|
||||
'tabtitle' => __('Blog Front Page', 'pirate-rogue'),
|
||||
'fields' => array(
|
||||
|
||||
'pirate_rogue_frontpage_general' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'General', 'pirate-rogue'),
|
||||
),
|
||||
'uku_front_hideblog' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Hide Default Blog', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_frontpage_general'
|
||||
),
|
||||
'uku_front_hidedate' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Hide Date', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_frontpage_general'
|
||||
),
|
||||
'uku_front_hidecomments' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Hide Comments', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_frontpage_general'
|
||||
),
|
||||
'uku_front_hidecats' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Hide Categories', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_frontpage_general'
|
||||
),
|
||||
'pirate_rogue_front_hideauthor' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Hide Author Names', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_frontpage_general'
|
||||
),
|
||||
'pirate_rogue_custom_latestposts'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Latest Posts Title', 'pirate-rogue'),
|
||||
'label' => __( 'Customize the "Latest Posts" title text above the blog content on your blog front page.', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_frontpage_general'
|
||||
),
|
||||
'pirate_rogue_custom_followus'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Follow Us Text', 'pirate-rogue'),
|
||||
'label' => __( 'Customize the "Follow us" text in your About section and footer social menus.', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_frontpage_general'
|
||||
),
|
||||
|
||||
|
||||
|
||||
'pirate_rogue_slider' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Featured Posts Slider', 'pirate-rogue')
|
||||
),
|
||||
'pirate_rogue_featuredtag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Slider tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_slider'
|
||||
),
|
||||
'pirate_rogue_featuredcat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Slider category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_slider'
|
||||
),
|
||||
'pirate_rogue_sliderstyle' => array(
|
||||
'type' => 'select',
|
||||
'title' => __( 'Style', 'pirate-rogue'),
|
||||
'label' => __( 'Choose the slider design.', 'pirate-rogue'),
|
||||
'liste' => array(
|
||||
'slider-fullwidth' => __( 'Fullwidth', 'pirate-rogue'),
|
||||
'slider-boxed' => __( 'Boxed', 'pirate-rogue'),
|
||||
// 'slider-fullscreen' => __( 'Fullscreen', 'pirate-rogue'),
|
||||
),
|
||||
'default' => 'slider-fullwidth',
|
||||
'parent' => 'pirate_rogue_slider'
|
||||
),
|
||||
'pirate_rogue_slideranimation' => array(
|
||||
'type' => 'select',
|
||||
'title' => __( 'Image Animation', 'pirate-rogue'),
|
||||
'label' => __( 'Choose, if you want the slider images to fade or slide from one image to the next.', 'pirate-rogue'),
|
||||
'liste' => array(
|
||||
'slider-slide' => __( 'Slide', 'pirate-rogue'),
|
||||
'slider-fade' => __( 'Fade', 'pirate-rogue'),
|
||||
),
|
||||
'default' => 'slider-slide',
|
||||
'parent' => 'pirate_rogue_slider'
|
||||
),
|
||||
'pirate_rogue_slider_autoplay' => array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Autoplay', 'pirate-rogue'),
|
||||
'default' => false,
|
||||
'parent' => 'pirate_rogue_slider'
|
||||
),
|
||||
'pirate_rogue_featured_slider_num' => array(
|
||||
'type' => 'range',
|
||||
'title' => __( 'Number of Slides', 'pirate-rogue'),
|
||||
'label' => __( 'How many slides of feature posts are displayed. Notice: the more slides are loaded, the worse the performance of the page will be.', 'pirate-rogue'),
|
||||
'min' => 2,
|
||||
'max' => 6,
|
||||
'step' => 1,
|
||||
'default' => 3,
|
||||
'parent' => 'pirate_rogue_slider'
|
||||
),
|
||||
'pirate_rogue_fallback_slider' => array(
|
||||
'type' => 'image',
|
||||
'title' => __( 'Fallback Thumbnail For Slider', 'pirate-rogue'),
|
||||
'label' => __( 'If thumbnail for a post is not avaible, use this image for the slider.', 'pirate-rogue'),
|
||||
'flex_width' => true, // Allow any width, making the specified value recommended. False by default.
|
||||
'flex_height' => false, // Require the resulting image to be exactly as tall as the height attribute (default).
|
||||
'width' => 1440,
|
||||
'height' => 690,
|
||||
'parent' => 'pirate_rogue_slider'
|
||||
),
|
||||
|
||||
'pirate_rogue_front_section_one' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section Featured Top', 'pirate-rogue'),
|
||||
),
|
||||
'uku_front_section_one_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title (optional)', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_one'
|
||||
),
|
||||
'uku_front_section_one_tag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Section Tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_one'
|
||||
),
|
||||
'uku_front_section_one_cat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Section Category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_one'
|
||||
),
|
||||
|
||||
|
||||
|
||||
'pirate_rogue_front_section_twocolumn' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section 2-Columns', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_front_section_twocolumn_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title (optional)', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_twocolumn'
|
||||
),
|
||||
'pirate_rogue_front_section_twocolumn_tag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Section Tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_twocolumn'
|
||||
),
|
||||
'pirate_rogue_front_section_twocolumn_cat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Section Category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_twocolumn'
|
||||
),
|
||||
'pirate_rogue_front_section_twocolumn_number' => array(
|
||||
'type' => 'range',
|
||||
'title' => __( 'Number of Posts', 'pirate-rogue'),
|
||||
'min' => 2,
|
||||
'max' => 16,
|
||||
'parent' => 'pirate_rogue_front_section_twocolumn'
|
||||
),
|
||||
|
||||
'pirate_rogue_front_section_threecolumn' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section 3-Columns', 'pirate-rogue'),
|
||||
),
|
||||
'uku_front_section_threecolumn_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title (optional)', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_threecolumn'
|
||||
),
|
||||
'uku_front_section_threecolumn_tag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Section Tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_threecolumn'
|
||||
),
|
||||
'uku_front_section_threecolumn_cat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Section Category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_threecolumn'
|
||||
),
|
||||
'uku_front_section_threecolumn_number' => array(
|
||||
'type' => 'range',
|
||||
'title' => __( 'Number of Posts', 'pirate-rogue'),
|
||||
'min' => 1,
|
||||
'max' => 12,
|
||||
'parent' => 'pirate_rogue_front_section_threecolumn'
|
||||
),
|
||||
'uku_front_section_threecolumn_excerpt'=> array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Show Post Excerpts', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_threecolumn'
|
||||
),
|
||||
|
||||
'pirate_rogue_front_section_fullwidth' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section Fullwidth', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_front_section_fullwidth_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title (optional)', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_fullwidth'
|
||||
),
|
||||
'pirate_rogue_front_section_fullwidth_tag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Section Tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_fullwidth'
|
||||
),
|
||||
'pirate_rogue_front_section_fullwidth_cat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Section Category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_fullwidth'
|
||||
),
|
||||
'pirate_rogue_front_section_fullwidth_number' => array(
|
||||
'type' => 'range',
|
||||
'title' => __( 'Number of Posts', 'pirate-rogue'),
|
||||
'min' => 1,
|
||||
'max' => 3,
|
||||
'default' => 1,
|
||||
'parent' => 'pirate_rogue_front_section_fullwidth'
|
||||
),
|
||||
|
||||
|
||||
'pirate_rogue_front_section_about' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section About', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_front_section_about_title' => array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_about'
|
||||
),
|
||||
'pirate_rogue_front_section_about_image' => array(
|
||||
'type' => 'image',
|
||||
'title' => __( 'About Image', 'pirate-rogue'),
|
||||
'label' => __( 'The recommended image width for the About image is 580 pixels.', 'pirate-rogue'),
|
||||
'flex_width' => true, // Allow any width, making the specified value recommended. False by default.
|
||||
'flex_height' => true, // Require the resulting image to be exactly as tall as the height attribute (default).
|
||||
'width' => 1440,
|
||||
'height' => 530,
|
||||
'parent' => 'pirate_rogue_front_section_about'
|
||||
),
|
||||
'pirate_rogue_front_section_about_text' => array(
|
||||
'type' => 'textarea',
|
||||
'title' => __( 'About Text (required)', 'pirate-rogue'),
|
||||
'label' => __( 'HTML is allowed.', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_about'
|
||||
),
|
||||
|
||||
|
||||
'pirate_rogue_front_section_two' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section Featured Bottom', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_front_section_two_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title (optional)', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_two'
|
||||
),
|
||||
'pirate_rogue_front_section_two_tag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Section Tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_two'
|
||||
),
|
||||
'pirate_rogue_front_section_two_cat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Section Category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_two'
|
||||
),
|
||||
|
||||
|
||||
'pirate_rogue_front_section_three' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section on Background', 'pirate-rogue'),
|
||||
),
|
||||
'uku_front_section_three_title' => array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title (optional)', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_three'
|
||||
),
|
||||
'uku_front_section_three_tag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Section Tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_three'
|
||||
),
|
||||
'uku_front_section_three_cat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Section Category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_three'
|
||||
),
|
||||
|
||||
'pirate_rogue_front_section_fourcolumn' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section 4-Columns', 'pirate-rogue'),
|
||||
),
|
||||
'uku_front_section_fourcolumn_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title (optional)', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_fourcolumn'
|
||||
),
|
||||
'uku_front_section_fourcolumn_tag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Section Tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_fourcolumn'
|
||||
),
|
||||
'uku_front_section_fourcolumn_cat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Section Category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_fourcolumn'
|
||||
),
|
||||
'uku_front_section_fourcolumn_number' => array(
|
||||
'type' => 'range',
|
||||
'title' => __( 'Number of Posts', 'pirate-rogue'),
|
||||
'min' => 4,
|
||||
'max' => 16,
|
||||
'step' => 2,
|
||||
'default' => 8,
|
||||
'parent' => 'pirate_rogue_front_section_fourcolumn'
|
||||
),
|
||||
'uku_front_section_fourcolumn_excerpt'=> array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Show Post Excerpts', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_fourcolumn'
|
||||
),
|
||||
|
||||
|
||||
|
||||
'pirate_rogue_front_section_sixcolumn' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section 6-Columns', 'pirate-rogue'),
|
||||
),
|
||||
'pirate_rogue_front_section_sixcolumn_title'=> array(
|
||||
'type' => 'text',
|
||||
'title' => __( 'Section Title (optional)', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_sixcolumn'
|
||||
),
|
||||
'pirate_rogue_front_section_sixcolumn_tag' => array(
|
||||
'type' => 'tag',
|
||||
'title' => __( 'Section Tag', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_sixcolumn'
|
||||
),
|
||||
'pirate_rogue_front_section_sixcolumn_cat' => array(
|
||||
'type' => 'category',
|
||||
'title' => __( 'Section Category', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_sixcolumn'
|
||||
),
|
||||
'pirate_rogue_front_section_sixcolumn_number' => array(
|
||||
'type' => 'range',
|
||||
'title' => __( 'Number of Posts', 'pirate-rogue'),
|
||||
'min' => 6,
|
||||
'max' => 24,
|
||||
'default' => 6,
|
||||
'step' => 2,
|
||||
'parent' => 'pirate_rogue_front_section_sixcolumn'
|
||||
),
|
||||
'pirate_rogue_front_section_sixcolumn_excerpt'=> array(
|
||||
'type' => 'toggle-switch',
|
||||
'title' => __( 'Show Post Excerpts', 'pirate-rogue'),
|
||||
'parent' => 'pirate_rogue_front_section_sixcolumn'
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
512
wp-content/themes/Pirate-Rogue/inc/helper-functions.php
Normal file
512
wp-content/themes/Pirate-Rogue/inc/helper-functions.php
Normal file
@@ -0,0 +1,512 @@
|
||||
<?php
|
||||
/*
|
||||
* Hilfereiche Funktionen für die Custom Fields
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_form_textarea' ) ) :
|
||||
function pirate_rogue_form_textarea($name= '', $prevalue = '', $labeltext = '', $cols=60, $rows=5, $howtotext = '') {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) {
|
||||
echo "<p>\n";
|
||||
echo ' <label for="'.$name.'">';
|
||||
echo $labeltext;
|
||||
echo "</label></p>\n";
|
||||
$prevalue = esc_textarea($prevalue);
|
||||
echo ' <textarea name="'.$name.'" id="'.$name.'" rows="'.$rows.'" cols="'.$cols.'">'.$prevalue.'</textarea>';
|
||||
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_textarea() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
if ( ! function_exists( 'pirate_rogue_form_wpeditor' ) ) :
|
||||
function pirate_rogue_form_wpeditor($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $small = true) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) {
|
||||
echo "<p>\n";
|
||||
echo ' <label for="'.$name.'">';
|
||||
echo $labeltext;
|
||||
echo "</label></p>\n";
|
||||
if ($small==true) {
|
||||
wp_editor( $prevalue, $name, array('teeny' => true, 'textarea_rows' => 5, 'media_buttons' => false) );
|
||||
} else {
|
||||
wp_editor( $prevalue, $name );
|
||||
}
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_wpeditor() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
if ( ! function_exists( 'pirate_rogue_form_text' ) ) :
|
||||
function pirate_rogue_form_text($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $placeholder='', $size = 0) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) {
|
||||
echo "<p>\n";
|
||||
echo ' <label for="'.$name.'">';
|
||||
echo $labeltext;
|
||||
echo "</label><br />\n";
|
||||
|
||||
echo ' <input type="text" ';
|
||||
if (intval($size)>0) {
|
||||
echo ' size="'.$size.'"';
|
||||
} else {
|
||||
echo ' class="large-text"';
|
||||
}
|
||||
echo ' name="'.$name.'" id="'.$name.'" value="'.$prevalue.'"';
|
||||
if (strlen(trim($placeholder))) {
|
||||
echo ' placeholder="'.$placeholder.'"';
|
||||
}
|
||||
|
||||
echo " />\n";
|
||||
echo "</p>\n";
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_text() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
if ( ! function_exists( 'pirate_rogue_form_email' ) ) :
|
||||
function pirate_rogue_form_email($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $placeholder='', $size = 0) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) {
|
||||
echo "<p>\n";
|
||||
echo ' <label for="'.$name.'">';
|
||||
echo $labeltext;
|
||||
echo "</label><br />\n";
|
||||
|
||||
echo ' <input type="email" ';
|
||||
if (intval($size)>0) {
|
||||
echo ' size="'.$size.'"';
|
||||
} else {
|
||||
echo ' class="large-text"';
|
||||
}
|
||||
echo ' name="'.$name.'" id="'.$name.'" value="'.$prevalue.'"';
|
||||
if (strlen(trim($placeholder))) {
|
||||
echo ' placeholder="'.$placeholder.'"';
|
||||
}
|
||||
|
||||
echo " />\n";
|
||||
echo "</p>\n";
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_email() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
if ( ! function_exists( 'pirate_rogue_form_number' ) ) :
|
||||
function pirate_rogue_form_number($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $min = 0, $max = 0, $step=1) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) {
|
||||
echo "<p>\n";
|
||||
echo ' <label for="'.$name.'">';
|
||||
echo $labeltext;
|
||||
echo "</label><br />\n";
|
||||
|
||||
echo ' <input type="number" ';
|
||||
|
||||
echo 'name="'.$name.'" id="'.$name.'" value="'.$prevalue.'"';
|
||||
if ($min>0) {
|
||||
echo ' min="'.$min.'"';
|
||||
}
|
||||
if ($max>0) {
|
||||
echo ' max="'.$max.'"';
|
||||
}
|
||||
if ($step>1) {
|
||||
echo ' step="'.$step.'"';
|
||||
}
|
||||
|
||||
echo " />\n";
|
||||
echo "</p>\n";
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_number() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_form_url' ) ) :
|
||||
function pirate_rogue_form_url($name= '', $prevalue = '', $labeltext = '', $howtotext = '', $placeholder='http://', $size = 0) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) {
|
||||
echo "<p>\n";
|
||||
echo ' <label for="'.$name.'">';
|
||||
echo $labeltext;
|
||||
echo "</label><br />\n";
|
||||
echo ' <input type="url" class="large-text" name="'.$name.'" id="'.$name.'" value="'.$prevalue.'"';
|
||||
if (strlen(trim($placeholder))) {
|
||||
echo ' placeholder="'.$placeholder.'"';
|
||||
}
|
||||
if (intval($size)>0) {
|
||||
echo ' length="'.$size.'"';
|
||||
}
|
||||
echo " />\n";
|
||||
echo "</p>\n";
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_url() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_form_onoff' ) ) :
|
||||
function pirate_rogue_form_onoff($name= '', $prevalue = 0, $labeltext = '', $howtotext = '' ) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) { ?>
|
||||
<div class="schalter">
|
||||
<select class="onoff" name="<?php echo $name; ?>" id="<?php echo $name; ?>">
|
||||
<option value="0" <?php selected(0,$prevalue);?>>Aus</option>
|
||||
<option value="1" <?php selected(1,$prevalue);?>>An</option>
|
||||
</select>
|
||||
<label for="<?php echo $name; ?>">
|
||||
<?php echo $labeltext; ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_onoff() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_form_select' ) ) :
|
||||
function pirate_rogue_form_select($name= '', $liste = array(), $prevalue, $labeltext = '', $howtotext = '', $showempty=1, $emptytext = '' ) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
$emptytext = pirate_rogue_san( $emptytext );
|
||||
|
||||
if (is_array($liste) && isset($name) && isset($labeltext)) { ?>
|
||||
<div class="liste">
|
||||
<p><label for="<?php echo $name; ?>">
|
||||
<?php echo $labeltext; ?>
|
||||
</label></p>
|
||||
<select name="<?php echo $name; ?>" id="<?php echo $name; ?>">
|
||||
<?php
|
||||
if ($showempty==1) {
|
||||
echo '<option value="">';
|
||||
if (!empty($emptytext)) {
|
||||
echo $emptytext;
|
||||
} else {
|
||||
_e('No selection','pirate-rogue');
|
||||
}
|
||||
echo '</option>';
|
||||
}
|
||||
|
||||
foreach($liste as $entry => $value){ ?>
|
||||
<option value="<?php echo $entry; ?>" <?php selected($entry,$prevalue);?>><?php echo $value; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_select() - array, name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_form_multiselect' ) ) :
|
||||
function pirate_rogue_form_multiselect($name= '', $liste = array(), $prevalues = array(), $labeltext = '', $howtotext = '', $showempty=1, $emptytext = '' ) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
$emptytext = pirate_rogue_san( $emptytext );
|
||||
|
||||
if (is_array($liste) && isset($name) && isset($labeltext)) { ?>
|
||||
<div class="liste">
|
||||
<p><label for="<?php echo $name; ?>">
|
||||
<?php echo $labeltext; ?>
|
||||
</label></p>
|
||||
<select size="5" multiple="1" name="<?php echo $name; ?>[]" id="<?php echo $name; ?>">
|
||||
<?php
|
||||
if ($showempty==1) {
|
||||
echo '<option value="">';
|
||||
if (!empty($emptytext)) {
|
||||
echo $emptytext;
|
||||
} else {
|
||||
_e('No selection','pirate-rogue');
|
||||
}
|
||||
echo '</option>';
|
||||
}
|
||||
|
||||
foreach($liste as $entry => $value){
|
||||
echo '<option value="'.$entry.'"';
|
||||
if (is_array($prevalues)) {
|
||||
foreach($prevalues as $pnum){
|
||||
if ($entry==$pnum)
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
}
|
||||
echo '>';
|
||||
echo $value;
|
||||
echo '</option>';
|
||||
|
||||
} ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_multiselect() - array, name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_form_image' ) ) :
|
||||
function pirate_rogue_form_image($name= '', $preimageid = 0, $labeltext = '', $howtotext = '', $width=300, $height=200 ) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) {
|
||||
echo '<p><label for="'.$name.'">';
|
||||
echo $labeltext;
|
||||
echo "</label></p>\n";
|
||||
|
||||
echo '<div class="uploader">';
|
||||
|
||||
$image = '';
|
||||
$imagehtml = '';
|
||||
if (isset($preimageid) && ($preimageid>0)) {
|
||||
$image = wp_get_attachment_image_src($preimageid, 'full');
|
||||
if (isset($image)) {
|
||||
$imagehtml = '<img class="image_show_'.$name.'" src="'.$image[0].'" width="'.$width.'" height="'.$height.'" alt="">';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div class="previewimage showimg_'.$name.'">';
|
||||
if (!empty($imagehtml)) {
|
||||
echo $imagehtml;
|
||||
}
|
||||
echo "</div>\n"; ?>
|
||||
|
||||
<input type="hidden" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo sanitize_key( $preimageid ) ; ?>" />
|
||||
|
||||
|
||||
<input class="button" name="image_button_<?php echo $name; ?>" id="image_button_<?php echo $name; ?>" value="<?php _e('Select image', 'pirate-rogue'); ?>" />
|
||||
<small><a href="#" class="image_remove_<?php echo $name; ?>"><?php _e( "Remove", 'pirate-rogue');?></a></small>
|
||||
<br><p class="howto"><?php echo $howtotext; ?>
|
||||
</p><script>
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#image_button_<?php echo $name; ?>').click(function() {
|
||||
wp.media.editor.send.attachment = function(props, attachment) {
|
||||
jQuery('#<?php echo $name; ?>').val(attachment.id);
|
||||
htmlshow = "<img src=\""+attachment.url + "\" width=\"<?php echo $width;?>\" height=\"<?php echo $height;?>\">";
|
||||
jQuery('.showimg_<?php echo $name; ?>').html(htmlshow);
|
||||
|
||||
}
|
||||
wp.media.editor.open(this);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('.image_remove_<?php echo $name; ?>').click(function() {
|
||||
jQuery('#<?php echo $name; ?>').val('');
|
||||
jQuery('.showimg_<?php echo $name; ?>').html('<?php _e('No image selected.', 'pirate-rogue'); ?>');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_image() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_form_link' ) ) :
|
||||
function pirate_rogue_form_link($name= '', $pretitle ='', $preurl ='' , $labeltext = '', $howtotext = '', $types = '' ) {
|
||||
$name = pirate_rogue_san( $name );
|
||||
$labeltext = pirate_rogue_san( $labeltext );
|
||||
if (isset($name) && isset($labeltext)) {
|
||||
wp_enqueue_script( 'wp-link' );
|
||||
echo '<div class="linkeingabe">';
|
||||
$rand = rand();
|
||||
echo '<h2 class="label">'.$labeltext.'</h2>';
|
||||
if (strlen(trim($howtotext))) {
|
||||
echo '<p class="howto">';
|
||||
echo $howtotext;
|
||||
echo "</p>\n";
|
||||
}
|
||||
echo '<div class="linkauswahl" id="container_'.$rand.'">';
|
||||
echo "<p>\n";
|
||||
echo '<label for="title_'.$rand.'_'.$name.'">'.__('Title','pirate-rogue');
|
||||
echo "</label><br />\n";
|
||||
echo '<input type="text" class="large-text" name="'.$name.'_title" id="title_'.$rand.'_'.$name.'" value="'.$pretitle.'">';
|
||||
echo "</p>\n";
|
||||
echo "<p>\n";
|
||||
echo '<label for="url_'.$rand.'_'.$name.'">'.__('URL','pirate-rogue');
|
||||
echo "</label><br />\n";
|
||||
echo '<input type="url" class="large-text" name="'.$name.'_url" id="url_'.$rand.'_'.$name.'" value="'.$preurl.'" placeholder="https://">';
|
||||
echo "</p>";
|
||||
echo '<p><input class="button link_button_'.$name.'" name="link_button_'.$name.'" id="link_button_'.$name.'" type="button" value="'.__('Select link','pirate-rogue').'"></p>';
|
||||
echo "</div>\n";
|
||||
|
||||
?>
|
||||
<script>
|
||||
|
||||
var link_btn_<?php echo $name ?> = (function ($) {
|
||||
var link_val_container<?php echo $rand ?> = $('#url_<?php echo $rand ?>_<?php echo $name ?>');
|
||||
var title_val_container<?php echo $rand ?> = $('#title_<?php echo $rand ?>_<?php echo $name ?>');
|
||||
|
||||
function _init() {
|
||||
$('.link_button_<?php echo $name ?>').on('click', function (event) {
|
||||
activedialog = '<?php echo $name ?>';
|
||||
wpActiveEditor = true;
|
||||
wpLink.open();
|
||||
wpLink.textarea = $(link_val_container<?php echo $rand ?>);
|
||||
_addLinkListeners();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function _addLinkListeners() {
|
||||
$('body').on('click', '#wp-link-submit', function (event) {
|
||||
if (activedialog=='<?php echo $name ?>') {
|
||||
var linkAtts = wpLink.getAttrs();
|
||||
$(link_val_container<?php echo $rand ?>).val(linkAtts.href);
|
||||
var title = linkAtts.title;
|
||||
if (title) {
|
||||
$(title_val_container<?php echo $rand ?>).val(title);
|
||||
}
|
||||
_removeLinkListeners(event);
|
||||
activedialog = '';
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '#wp-link-cancel, #wp-link-close', function (event) {
|
||||
_removeLinkListeners(event);
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function _removeLinkListeners(event) {
|
||||
wpLink.textarea = $(link_val_container<?php echo $rand ?>);
|
||||
wpLink.close();
|
||||
|
||||
event.preventDefault ? event.preventDefault() : event.returnValue = false;
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
return {
|
||||
init: _init,
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
var activedialog = '';
|
||||
link_btn_<?php echo $name ?>.init();
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
echo "</div>\n";
|
||||
|
||||
|
||||
} else {
|
||||
echo _('Invalid call to pirate_rogue_form_link() - name or label is missing.', 'pirate-rogue');
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_save_standard' ) ) :
|
||||
function pirate_rogue_save_standard($name, $val, $post_id, $post_type, $type='text') {
|
||||
if (isset($name) && isset($post_id) && isset($post_type)) {
|
||||
|
||||
if ($type == 'url') {
|
||||
$newval = ( isset( $val ) ? esc_url( $val ) : 0 );
|
||||
} elseif ($type == 'email') {
|
||||
$newval = ( isset( $val ) ? sanitize_email( $val ) : 0 );
|
||||
} elseif ($type == 'int') {
|
||||
$newval = ( isset( $val ) ? intval( $val ) : 0 );
|
||||
} elseif ($type == 'text') {
|
||||
$newval = ( isset( $val ) ? sanitize_text_field( $val ) : 0 );
|
||||
} elseif ($type == 'textnohtml') {
|
||||
$newval = ( isset( $val ) ? wp_strip_all_tags( $val ) : 0 );
|
||||
} elseif ($type == 'textarea') {
|
||||
$newval = ( isset( $val ) ? esc_textarea( $val ) : 0 );
|
||||
} elseif ($type == 'wpeditor') {
|
||||
$newval = wp_kses_post($val);
|
||||
} else {
|
||||
$newval = ( isset( $val ) ? sanitize_text_field( $val ) : 0 );
|
||||
}
|
||||
$oldval = get_post_meta( $post_id, $name, true );
|
||||
if (!empty($newval)) {
|
||||
update_post_meta( $post_id, $name, $newval );
|
||||
} elseif ($oldval) {
|
||||
delete_post_meta( $post_id, $name, $oldval );
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
if ( ! function_exists( 'pirate_rogue_san' ) ) :
|
||||
function pirate_rogue_san($s){
|
||||
return filter_var(trim($s), FILTER_SANITIZE_STRING);
|
||||
}
|
||||
endif;
|
||||
55
wp-content/themes/Pirate-Rogue/inc/jetpack.php
Normal file
55
wp-content/themes/Pirate-Rogue/inc/jetpack.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Jetpack Compatibility File
|
||||
* See: http://jetpack.me/
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Customize Jetpack Related Posts
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function jetpackme_more_related_posts( $options ) {
|
||||
$options['size'] = 4;
|
||||
return $options;
|
||||
}
|
||||
add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_more_related_posts' );
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Remove Related Posts in defalut position (added via shortcode to the single.php)
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function jetpackme_remove_rp() {
|
||||
if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
|
||||
$jprp = Jetpack_RelatedPosts::init();
|
||||
$callback = array( $jprp, 'filter_add_target_to_dom' );
|
||||
remove_filter( 'the_content', $callback, 40 );
|
||||
}
|
||||
}
|
||||
add_filter( 'wp', 'jetpackme_remove_rp', 20 );
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Remove Sharing Icons position (added via shortcode to the single.php)
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function jptweak_remove_share() {
|
||||
remove_filter( 'the_content', 'sharing_display',19 );
|
||||
remove_filter( 'the_excerpt', 'sharing_display',19 );
|
||||
if ( class_exists( 'Jetpack_Likes' ) ) {
|
||||
remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'loop_start', 'jptweak_remove_share' );
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Jetpack Setup
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function uku_jetpack_setup() {
|
||||
|
||||
/**
|
||||
* Add theme support for Infinite Scroll.
|
||||
*/
|
||||
add_theme_support( 'infinite-scroll', array(
|
||||
'type' => 'click',
|
||||
'container' => 'primary',
|
||||
) );
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'uku_jetpack_setup' );
|
||||
41
wp-content/themes/Pirate-Rogue/inc/pluginsupport.php
Normal file
41
wp-content/themes/Pirate-Rogue/inc/pluginsupport.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Pluginsupport - special filters and hooks for plugins
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Reset canonical URL for wpSEO
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
add_filter(
|
||||
'wpseo_set_canonical',
|
||||
function($input) {
|
||||
if (is_single()) {
|
||||
$canonical = get_post_meta( get_the_ID(), 'pirate_rogue_canonical', true );
|
||||
if ($canonical) {
|
||||
$canonical = esc_url( $canonical );
|
||||
if ($canonical) {
|
||||
return $canonical;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Plugin TinyMCE: Button für Seitenumbruch ergänzen
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
add_filter( 'mce_buttons', 'kb_add_next_page_button', 1, 2 );
|
||||
function kb_add_next_page_button( $buttons, $id ) {
|
||||
if ( 'content' === $id ) {
|
||||
array_splice( $buttons, 13, 0, 'wp_page' );
|
||||
}
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Oh no! Here is the end!?!
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
739
wp-content/themes/Pirate-Rogue/inc/shortcodes.php
Normal file
739
wp-content/themes/Pirate-Rogue/inc/shortcodes.php
Normal file
@@ -0,0 +1,739 @@
|
||||
<?php
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Pirate Rogue Shortcodes Shortcodes
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
// Enable shortcodes in widget areas
|
||||
add_filter( 'widget_text', 'do_shortcode' );
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Multi Columns Shortcodes
|
||||
/* Don't forget to add "_last" behind the shortcode if it is the last column.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
// Two Columns
|
||||
function pirate_rogue_shortcode_two_columns_one( $atts, $content = null ) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="two-columns-one'.$addclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'two_columns_one', 'pirate_rogue_shortcode_two_columns_one' );
|
||||
|
||||
function pirate_rogue_shortcode_two_columns_one_last( $atts, $content = null ) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="two-columns-one'.$addclass.' last">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'two_columns_one_last', 'pirate_rogue_shortcode_two_columns_one_last' );
|
||||
|
||||
// Three Columns
|
||||
function pirate_rogue_shortcode_three_columns_one($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="three-columns-one'.$addclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'three_columns_one', 'pirate_rogue_shortcode_three_columns_one' );
|
||||
|
||||
function pirate_rogue_shortcode_three_columns_one_last($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="three-columns-one'.$addclass.' last">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'three_columns_one_last', 'pirate_rogue_shortcode_three_columns_one_last' );
|
||||
|
||||
function pirate_rogue_shortcode_three_columns_two($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="three-columns-two'.$addclass.'">' . do_shortcode( ($content) ). '</div>';
|
||||
}
|
||||
add_shortcode( 'three_columns_two', 'pirate_rogue_shortcode_three_columns_two' );
|
||||
|
||||
function pirate_rogue_shortcode_three_columns_two_last($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="three-columns-two'.$addclass.' last">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'three_columns_two_last', 'pirate_rogue_shortcode_three_columns_two_last' );
|
||||
|
||||
// Four Columns
|
||||
function pirate_rogue_shortcode_four_columns_one($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="four-columns-one'.$addclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'four_columns_one', 'pirate_rogue_shortcode_four_columns_one' );
|
||||
|
||||
function pirate_rogue_shortcode_four_columns_one_last($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="four-columns-one'.$addclass.' last">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'four_columns_one_last', 'pirate_rogue_shortcode_four_columns_one_last' );
|
||||
|
||||
function pirate_rogue_shortcode_four_columns_two($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="four-columns-two'.$addclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'four_columns_two', 'pirate_rogue_shortcode_four_columns_two' );
|
||||
|
||||
function pirate_rogue_shortcode_four_columns_two_last($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="four-columns-two'.$addclass.' last">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'four_columns_two_last', 'pirate_rogue_shortcode_four_columns_two_last' );
|
||||
|
||||
function pirate_rogue_shortcode_four_columns_three($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="four-columns-three'.$addclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'four_columns_three', 'pirate_rogue_shortcode_four_columns_three' );
|
||||
|
||||
function pirate_rogue_shortcode_four_columns_three_last($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass=' '.$color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
return '<div class="four-columns-three'.$addclass.' last">' . do_shortcode( ($content) ). '</div>';
|
||||
}
|
||||
add_shortcode( 'four_columns_three_last', 'pirate_rogue_shortcode_four_columns_three_last' );
|
||||
|
||||
|
||||
// Divide Text Shortcode
|
||||
function pirate_rogue_shortcode_divider($atts, $content = null) {
|
||||
return '<div class="divider"></div>';
|
||||
}
|
||||
add_shortcode( 'divider', 'pirate_rogue_shortcode_divider' );
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Info Boxes Shortcodes
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_shortcode_fullwidth($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'color' => '',
|
||||
'lighten' => '',
|
||||
'scrollleft' => '',
|
||||
'background' => '',
|
||||
'fixed' => '',
|
||||
'maxheight' => '',
|
||||
), $atts));
|
||||
$addclass = '';
|
||||
if (isset($color)) {
|
||||
$setlighten = '';
|
||||
if ($lighten) {
|
||||
$setlighten = ' lighten';
|
||||
}
|
||||
$color = pirate_rogue_columns_checkcolor($color);
|
||||
if (!empty($color)) {
|
||||
$addclass= $color;
|
||||
$addclass .= $setlighten;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($scrollleft)) {
|
||||
$addclass .= ' scrollleft';
|
||||
}
|
||||
$setstyle = '';
|
||||
$setinnerstyle = '';
|
||||
if (!empty($maxheight)) {
|
||||
$maxheight = intval($maxheight);
|
||||
if ($maxheight > 0) {
|
||||
$setstyle = 'height: '.$maxheight.'px; overflow:hidden;';
|
||||
}
|
||||
}
|
||||
if (!empty($background)) {
|
||||
$background = esc_url($background);
|
||||
if (!empty($background)) {
|
||||
$setstyle .= 'background-image: url('.$background.'); background-repeat: no-repeat; ';
|
||||
}
|
||||
if (!empty($fixed) ) {
|
||||
$setstyle .= 'background-attachment: fixed;';
|
||||
}
|
||||
|
||||
$setstyle .= 'background-size: cover;';
|
||||
|
||||
$addclass .= ' withbackground';
|
||||
}
|
||||
if (!empty($setstyle)) {
|
||||
$setstyle = ' style="'.$setstyle.'"';
|
||||
}
|
||||
if (!empty($setinnerstyle)) {
|
||||
$setinnerstyle = ' style="'.$setinnerstyle.'"';
|
||||
}
|
||||
|
||||
if (!empty($addclass)) {
|
||||
$addclass = ' class="'.$addclass.'"';
|
||||
}
|
||||
|
||||
if (is_page()) {
|
||||
// Close sourounding markup, then insert secxtion, then open markup for page again
|
||||
|
||||
$close_markup = '</div> <!-- close entry content -->';
|
||||
$close_markup .= '</article> <!-- close article -->';
|
||||
$close_markup .= '</div> <!-- close #primary div -->';
|
||||
$close_markup .= '</div> <!-- close #blog wrap -->';
|
||||
|
||||
$open_markup = '<div class="blog-wrap cf">';
|
||||
$open_markup .= '<div class="site-content cf">';
|
||||
$open_markup .= '<article class="cf page hentry">';
|
||||
$open_markup .= '<div class="entry-content">';
|
||||
$innerstyle = '<div class="fullwidth-inner"'.$setinnerstyle.'>';
|
||||
|
||||
$res = $close_markup.'<section id="section-fullwidth"'.$addclass.$setstyle.'>' .$innerstyle. do_shortcode( ($content) ). '</div></section>'.$open_markup;
|
||||
return $res;
|
||||
|
||||
}
|
||||
}
|
||||
add_shortcode( 'section_fullwidth', 'pirate_rogue_shortcode_fullwidth' );
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Info Boxes Shortcodes
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
function pirate_rogue_shortcode_white_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box white-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'white_box', 'pirate_rogue_shortcode_white_box' );
|
||||
|
||||
function pirate_rogue_shortcode_yellow_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box yellow-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'yellow_box', 'pirate_rogue_shortcode_yellow_box' );
|
||||
|
||||
function pirate_rogue_shortcode_red_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box red-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'red_box', 'pirate_rogue_shortcode_red_box' );
|
||||
|
||||
function pirate_rogue_shortcode_blue_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box blue-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'blue_box', 'pirate_rogue_shortcode_blue_box' );
|
||||
|
||||
function pirate_rogue_shortcode_green_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box green-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'green_box', 'pirate_rogue_shortcode_green_box' );
|
||||
|
||||
function pirate_rogue_shortcode_lightgrey_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box lightgrey-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'lightgrey_box', 'pirate_rogue_shortcode_lightgrey_box' );
|
||||
|
||||
function pirate_rogue_shortcode_grey_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box grey-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'grey_box', 'pirate_rogue_shortcode_grey_box' );
|
||||
|
||||
function pirate_rogue_shortcode_dark_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box dark-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'dark_box', 'pirate_rogue_shortcode_dark_box' );
|
||||
|
||||
function pirate_rogue_shortcode_maincolor_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
return '<div class="box maincolor-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'maincolor_box', 'pirate_rogue_shortcode_maincolor_box' );
|
||||
|
||||
function pirate_rogue_shortcode_secondcolor_box($atts, $content = null) {
|
||||
extract(shortcode_atts(array(
|
||||
'background' => '',
|
||||
), $atts));
|
||||
|
||||
$setinvertclass = '';
|
||||
if ($background) {
|
||||
$setinvertclass = ' invertbox';
|
||||
}
|
||||
|
||||
return '<div class="box secondcolor-box'.$setinvertclass.'">' . do_shortcode( ($content) ) . '</div>';
|
||||
}
|
||||
add_shortcode( 'secondcolor_box', 'pirate_rogue_shortcode_secondcolor_box' );
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Buttons Shortcodes
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_button( $atts, $content = null ) {
|
||||
extract(shortcode_atts(array(
|
||||
'link' => '#',
|
||||
'target' => '',
|
||||
'color' => '',
|
||||
'size' => '',
|
||||
'class' => ''
|
||||
), $atts));
|
||||
|
||||
$class = $class ? ' ' . esc_attr( $class ) : '';
|
||||
$color = ($color) ? ' '.$color. '-btn' : '';
|
||||
$size = ($size) ? ' '.$size. '-btn' : '';
|
||||
$target = ($target == 'blank') ? ' target="_blank"' : '';
|
||||
|
||||
$out = '<a' .$target. ' class="standard-btn' .$color.$size.$class. '" href="' .$link. '"><span>' .do_shortcode($content). '</span></a>';
|
||||
|
||||
return $out;
|
||||
}
|
||||
add_shortcode('button', 'pirate_rogue_button');
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Accordion: Surrounding Markup
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_accordion( $atts, $content = null ) {
|
||||
|
||||
if( isset($GLOBALS['accordion_count']) )
|
||||
$GLOBALS['accordion_count']++;
|
||||
else
|
||||
$GLOBALS['accordion_count'] = 0;
|
||||
|
||||
$defaults = array();
|
||||
extract( shortcode_atts( $defaults, $atts ) );
|
||||
$output = '';
|
||||
|
||||
$output .= '<div class="accordion" id="accordion-' . $GLOBALS['accordion_count'] . '">';
|
||||
$output .= do_shortcode( $content );
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
add_shortcode('accordion', 'pirate_rogue_accordion' );
|
||||
// add_shortcode('accordionsub', array( $this, 'pirate_rogue_accordion' ));
|
||||
// Define more as one shortcode name to allow nestet accordions
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Accordion: Single Accordion Tab
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_accordion_tab( $atts, $content = null ) {
|
||||
|
||||
if( !isset($GLOBALS['current_accordiontab']) )
|
||||
$GLOBALS['current_accordiontab'] = 0;
|
||||
else
|
||||
$GLOBALS['current_accordiontab']++;
|
||||
|
||||
|
||||
$defaults = array( 'title' => 'Tab', 'color' => '', 'id' => '', 'load' => '');
|
||||
extract( shortcode_atts( $defaults, $atts ) );
|
||||
|
||||
$addclass = '';
|
||||
|
||||
$title = esc_attr($title);
|
||||
$color = $color ? ' ' . esc_attr( $color ) : '';
|
||||
$load = $load ? ' ' . esc_attr( $load ) : '';
|
||||
|
||||
if (!empty($load)) {
|
||||
$addclass .= " ".$load;
|
||||
}
|
||||
|
||||
$id = intval($id) ? intval($id) : 0;
|
||||
if ($id<1) {
|
||||
$id = $GLOBALS['current_accordiontab'];
|
||||
}
|
||||
|
||||
$output = '<div class="accordion-group'.$color.'">';
|
||||
$output .= '<div class="accordion-heading acc-head-'.$id.'"><a class="accordion-toggle';
|
||||
$output .='" data-toggle="collapse" data-parent="#accordion-' . $GLOBALS['accordion_count'] . '" href="#collapse_' . $id .'">' . $title . '</a></div>'."\n";
|
||||
$output .= '<div id="collapse_' . $id . '" class="accordion-body'. $addclass .'">';
|
||||
$output .= '<div class="accordion-inner clearfix">'."\n";
|
||||
$output .= do_shortcode($content);
|
||||
$output .= '</div>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
add_shortcode('collapse', 'pirate_rogue_accordion_tab');
|
||||
add_shortcode('accordion-item', 'pirate_rogue_accordion_tab');
|
||||
add_shortcode('accordion-tab','pirate_rogue_accordion_tab' );
|
||||
|
||||
// Define more as one shortcode name to allow nestet accordions
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Shortcodes to display feature sections top
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_shortcode_section_featured_3to1( $atts, $content = null ) {
|
||||
extract(shortcode_atts(array(
|
||||
'cat' => '',
|
||||
'tag' => '',
|
||||
'title' => '',
|
||||
'id' => '',
|
||||
'num' => '',
|
||||
), $atts));
|
||||
|
||||
$cat = ($cat) ? $cat : '';
|
||||
$tag = ($tag) ? $tag : '';
|
||||
$title = esc_attr($title);
|
||||
$id = ($id) ? $id : '';
|
||||
$num = ($num) ? intval($num) : 5;
|
||||
|
||||
$out = pirate_rogue_section_featured_3to1($tag, $cat, $title, $num, $id, 'shortcode-section');
|
||||
|
||||
if (empty($out)) {
|
||||
echo '<p class="box red-box">'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'</p>';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
add_shortcode('section_featured_3to1', 'pirate_rogue_shortcode_section_featured_3to1');
|
||||
add_shortcode('section_featured_top', 'pirate_rogue_shortcode_section_featured_3to1');
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Shortcodes to display feature sections bottom
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_shortcode_section_featured_1to3( $atts, $content = null ) {
|
||||
extract(shortcode_atts(array(
|
||||
'cat' => '',
|
||||
'tag' => '',
|
||||
'title' => '',
|
||||
'id' => '',
|
||||
'num' => '',
|
||||
), $atts));
|
||||
|
||||
$cat = ($cat) ? $cat : '';
|
||||
$tag = ($tag) ? $tag : '';
|
||||
$title = esc_attr($title);
|
||||
$id = ($id) ? $id : '';
|
||||
$num = ($num) ? intval($num) : 9;
|
||||
|
||||
$out = pirate_rogue_section_featured_1to3($tag, $cat, $title, $num, $id, 'shortcode-section');
|
||||
|
||||
if (empty($out)) {
|
||||
echo '<p class="box red-box">'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'</p>';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
add_shortcode('section_featured_1to3', 'pirate_rogue_shortcode_section_featured_1to3');
|
||||
add_shortcode('section_featured_bottom', 'pirate_rogue_shortcode_section_featured_1to3');
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Shortcodes to display two column section
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_shortcode_section_twocolumn( $atts, $content = null ) {
|
||||
extract(shortcode_atts(array(
|
||||
'cat' => '',
|
||||
'tag' => '',
|
||||
'title' => '',
|
||||
'num' => '',
|
||||
), $atts));
|
||||
|
||||
$cat = ($cat) ? $cat : '';
|
||||
$tag = ($tag) ? $tag : '';
|
||||
$title = esc_attr($title);
|
||||
$num = ($num) ? intval($num) : 4;
|
||||
|
||||
$out = pirate_rogue_section_twocolumn($tag, $cat, $title, $num, 'shortcode-section');
|
||||
|
||||
if (empty($out)) {
|
||||
echo '<p class="box red-box">'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'</p>';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
add_shortcode('section_twocolumn', 'pirate_rogue_shortcode_section_twocolumn');
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Shortcodes to display two column section
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_shortcode_blogroll( $atts, $content = null ) {
|
||||
extract(shortcode_atts(array(
|
||||
'cat' => '',
|
||||
'tag' => '',
|
||||
'num' => '',
|
||||
), $atts));
|
||||
|
||||
$cat = ($cat) ? $cat : '';
|
||||
$tag = ($tag) ? $tag : '';
|
||||
$num = ($num) ? intval($num) : 4;
|
||||
|
||||
$out = pirate_rogue_blogroll($tag, $cat, $num);
|
||||
|
||||
if (empty($out)) {
|
||||
echo '<p class="box red-box">'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'</p>';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
add_shortcode('blogroll', 'pirate_rogue_shortcode_blogroll');
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Shortcodes to display articlelist
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_shortcode_articlelist( $atts, $content = null ) {
|
||||
extract(shortcode_atts(array(
|
||||
'cat' => '',
|
||||
'tag' => '',
|
||||
|
||||
'num' => '',
|
||||
'class' => '',
|
||||
'title' => '',
|
||||
), $atts));
|
||||
$title = esc_attr($title);
|
||||
$cat = ($cat) ? $cat : '';
|
||||
$tag = ($tag) ? $tag : '';
|
||||
$num = ($num) ? intval($num) : 5;
|
||||
$class = ($class) ? $class : '';
|
||||
$out = pirate_rogue_articlelist($tag, $cat, $num,$class, $title);
|
||||
|
||||
if (empty($out)) {
|
||||
echo '<p class="box red-box">'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'</p>';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
add_shortcode('articlelist', 'pirate_rogue_shortcode_articlelist');
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Check if color attribut is valid
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_columns_checkcolor($color = '') {
|
||||
if ( ! in_array( $color, array( 'black', 'red', 'yellow', 'green', 'blue', 'white', 'lightgrey', 'grey', 'dark', 'maincolor', 'secondcolor' ) ) ) {
|
||||
return '';
|
||||
}
|
||||
return $color;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* The end of this file inc/shortcodes.php as you know it
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
854
wp-content/themes/Pirate-Rogue/inc/template-functions.php
Normal file
854
wp-content/themes/Pirate-Rogue/inc/template-functions.php
Normal file
@@ -0,0 +1,854 @@
|
||||
<?php
|
||||
/**
|
||||
* Additional features to allow styling of the templates
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Extends the default WordPress body classes
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_body_class( $classes ) {
|
||||
$classes[] = 'uku-standard';
|
||||
|
||||
if ('colorful' != get_theme_mod( 'pirate_rogue_socialmedia_style' ) ) {
|
||||
$classes[] = 'socialmedia-'.get_theme_mod( 'pirate_rogue_socialmedia_style' );
|
||||
}
|
||||
if ('darkcolor' != get_theme_mod( 'pirate_rogue_search_overlay_backgroundcolor' ) ) {
|
||||
$classes[] = 'searchbar-'.get_theme_mod( 'pirate_rogue_search_overlay_backgroundcolor' );
|
||||
}
|
||||
|
||||
|
||||
// If no sidebar for pages defined, make the page without sidebar ;)
|
||||
$pirate_rogue_page_sidebar = get_post_meta( get_the_ID(), 'pirate_rogue_page_sidebar', true );
|
||||
if ( is_page() && !is_active_sidebar( 'sidebar-2' ) && (empty($pirate_rogue_page_sidebar)) ) {
|
||||
$classes[] = 'no-sidebar';
|
||||
}
|
||||
if (('' != get_theme_mod( 'pirate_rogue_front_hideauthor' ) ) || ('' != get_theme_mod( 'pirate_rogue_all_hideauthor' ) )) {
|
||||
$classes[] = 'no-author';
|
||||
}
|
||||
|
||||
if ( '' != get_the_post_thumbnail ()) {
|
||||
$classes[] = 'has-thumb';
|
||||
}
|
||||
if ( has_header_image() ) {
|
||||
$classes[] = 'headerimg-on';
|
||||
}
|
||||
if ( '' != get_theme_mod( 'pirate_rogue_hidecomments' ) ) {
|
||||
$classes[] = 'toggledcomments';
|
||||
}
|
||||
if ( '' != get_theme_mod( 'uku_customlogo' ) ) {
|
||||
$classes[] = 'custom-logo-on';
|
||||
}
|
||||
if ( '' != get_theme_mod( 'pirate_rogue_hidetagline' ) ) {
|
||||
$classes[] = 'hide-tagline';
|
||||
}
|
||||
if ('sidebar-left' == get_theme_mod( 'pirate_rogue_sidebar' ) ) {
|
||||
$classes[] = 'sidebar-left';
|
||||
}
|
||||
if ( is_page_template( 'page-templates/no-sidebar.php' ) ) {
|
||||
$classes[] = 'no-sidebar';
|
||||
}
|
||||
if ('sidebar-no' == get_theme_mod( 'pirate_rogue_sidebar' ) ) {
|
||||
$classes[] = 'no-sidebar';
|
||||
}
|
||||
if (is_single() && 'sidebar-no-single' == get_theme_mod( 'pirate_rogue_sidebar_hide' ) ) {
|
||||
$classes[] = 'no-sidebar';
|
||||
}
|
||||
if (is_front_page() && 'sidebar-no-front' == get_theme_mod( 'pirate_rogue_sidebar_hide' ) ) {
|
||||
$classes[] = 'no-sidebar';
|
||||
}
|
||||
if ('sidebar-no' == get_theme_mod( 'pirate_rogue_sidebar_hide' ) ) {
|
||||
$classes[] = 'no-sidebar';
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_featuredtag' ) || '' != get_theme_mod( 'pirate_rogue_featuredcat' ) ) {
|
||||
$classes[] = 'slider-on';
|
||||
}
|
||||
if ('slider-boxed' == get_theme_mod( 'pirate_rogue_sliderstyle' ) ) {
|
||||
$classes[] = 'slider-boxed';
|
||||
}
|
||||
if (('' != get_theme_mod( 'pirate_rogue_slider_autoplay' )) && (true== get_theme_mod( 'pirate_rogue_slider_autoplay' )) ) {
|
||||
$classes[] = 'slider-autoplay';
|
||||
} else {
|
||||
$classes[] = 'slider-noplay';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ('slider-fullscreen' == get_theme_mod( 'pirate_rogue_sliderstyle' ) ) {
|
||||
$classes[] = 'slider-fullscreen';
|
||||
}
|
||||
if ('slider-fade' == get_theme_mod( 'pirate_rogue_slideranimation' ) ) {
|
||||
$classes[] = 'slider-fade';
|
||||
}
|
||||
if ('header-boxed' == get_theme_mod( 'pirate_rogue_headerstyle' ) ) {
|
||||
$classes[] = 'header-boxed';
|
||||
}
|
||||
if ('header-fullscreen' == get_theme_mod( 'pirate_rogue_headerstyle' ) ) {
|
||||
$classes[] = 'header-fullscreen';
|
||||
}
|
||||
if ('dark' == get_theme_mod( 'pirate_rogue_fixedheader' ) ) {
|
||||
$classes[] = 'hide-header-sticky';
|
||||
}
|
||||
|
||||
if ( ! is_active_sidebar( 'sidebar-offcanvas' ) ) {
|
||||
$classes[] = 'offcanvas-widgets-off';
|
||||
}
|
||||
if (is_single()) {
|
||||
if ( comments_open() && '' != get_theme_mod ( 'pirate_rogue_hidecomments' ) && '0' == get_comments_number() ) {
|
||||
$classes[] = 'comments-show';
|
||||
}
|
||||
}
|
||||
|
||||
// Option to add body classes via custom fields
|
||||
if ( get_post_meta( get_the_ID(), 'pirate_rogue_canonical', true ) ) {
|
||||
$classes[] = 'is-mirror';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'sidebar-left', true ) ) {
|
||||
$classes[] = 'sidebar-left';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'no-sidebar', true ) ) {
|
||||
$classes[] = 'no-sidebar';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'header-fullscreen', true ) ) {
|
||||
$classes[] = 'header-fullscreen';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'header-boxed', true ) ) {
|
||||
$classes[] = 'header-boxed';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'slider-boxed', true ) ) {
|
||||
$classes[] = 'slider-boxed';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'slider-fullscreen', true ) ) {
|
||||
$classes[] = 'slider-fullscreen';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'slider-on', true ) ) {
|
||||
$classes[] = 'slider-on';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( get_post_meta( get_the_ID(), 'headerimg-on', true ) ) {
|
||||
$classes[] = 'headerimg-on';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'blog', true ) ) {
|
||||
$classes[] = 'blog';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'headerfont-light', true ) ) {
|
||||
$classes[] = 'headerfont-light';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'imagefont-dark', true ) ) {
|
||||
$classes[] = 'imagefont-dark';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'disable-share', true ) ) {
|
||||
$classes[] = 'disable-share';
|
||||
}
|
||||
if ( get_post_meta( get_the_ID(), 'post_class', true) == 'no-thumb' ) {
|
||||
$classes[] = 'no-thumb';
|
||||
}
|
||||
|
||||
if (is_404()) {
|
||||
$classes[] = 'no-sidebar';
|
||||
// No diebadr for 404 pages due to danger of loops cause of 404-files in sidebar :)
|
||||
}
|
||||
$logo = pirate_rogue_get_custom_logo();
|
||||
if (( !empty($logo) ) && ( has_custom_logo() )) {
|
||||
if (!get_theme_mod('pirate_rogue_show_labelonlogo') && !get_theme_mod('pirate_rogue_show_titleonlogo')) {
|
||||
$classes[] = 'no-header-text';
|
||||
} elseif (get_theme_mod('pirate_rogue_show_labelonlogo') && !get_theme_mod('pirate_rogue_show_titleonlogo')) {
|
||||
$classes[] = 'no-header-title';
|
||||
} elseif (get_theme_mod('pirate_rogue_show_titleonlogo') && !get_theme_mod('pirate_rogue_show_labelonlogo')) {
|
||||
$classes[] = 'no-header-subtitle';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ('' != get_theme_mod( 'uku_front_section_twocolumn_excerpt') ) {
|
||||
$classes[] = 'front_section_twocolumn_excerpt';
|
||||
}
|
||||
if ('' != get_theme_mod( 'uku_front_section_threecolumn_excerpt' ) ) {
|
||||
$classes[] = 'front_section_threecolumn_excerpt';
|
||||
}
|
||||
if ('' != get_theme_mod( 'uku_front_section_fourcolumn_excerpt' ) ) {
|
||||
$classes[] = 'front_section_fourcolumn_excerpt';
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_front_section_sixcolumn_excerpt' ) ) {
|
||||
$classes[] = 'front_section_sixcolumn_excerpt';
|
||||
}
|
||||
if ('' != get_theme_mod( 'uku_front_hidedate' ) ) {
|
||||
$classes[] = 'front_hidedate';
|
||||
}
|
||||
if ('' != get_theme_mod( 'uku_front_hidecomments' ) ) {
|
||||
$classes[] = 'front_hidecomments';
|
||||
}
|
||||
if ('' != get_theme_mod( 'uku_front_hidecats' ) ) {
|
||||
$classes[] = 'front_hidecats';
|
||||
}
|
||||
|
||||
if ('' != get_theme_mod( 'pirate_rogue_devider_hideimage' ) ) {
|
||||
$classes[] = 'devider_hideimage';
|
||||
}
|
||||
|
||||
// Head
|
||||
if ('' != get_theme_mod( 'pirate_rogue_head_background_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_head_background_color' );
|
||||
$classname = 'head-bgcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_head_text_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_head_text_color' );
|
||||
$classname = 'head-textcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_head_linkhover_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_head_linkhover_color' );
|
||||
$classname = 'head-linkborder-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_actionbutton_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_actionbutton_color' );
|
||||
$classname = 'actionbutton-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Main
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_background_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_background_color' );
|
||||
$classname = 'main-bgcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_text_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_text_color' );
|
||||
$classname = 'main-textcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_link_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_link_color' );
|
||||
$classname = 'main-linkcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_linkhover_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_linkhover_color' );
|
||||
$classname = 'main-linkhovercol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_headline_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_headline_color' );
|
||||
$classname = 'main-headlinecol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_titleunderline_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_titleunderline_color' );
|
||||
$classname = 'main-titleunderline-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_listitem_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_listitem_color' );
|
||||
$classname = 'main-listitem-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_quoteborder_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_quoteborder_color' );
|
||||
$classname = 'main-quoteborder-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Footer
|
||||
if ('' != get_theme_mod( 'pirate_rogue_footer_background_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_footer_background_color' );
|
||||
$classname = 'footer-bgcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_footer_text_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_footer_text_color' );
|
||||
$classname = 'footer-textcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_footer_link_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_footer_link_color' );
|
||||
$classname = 'footer-linkcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_footer_linkhover_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_footer_linkhover_color' );
|
||||
$classname = 'footer-linkhovercol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_footer_headline_color' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_footer_headline_color' );
|
||||
$classname = 'footer-headlinecol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_meta_bgcol' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_meta_bgcol' );
|
||||
$classname = 'main-meta-bgcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_meta_bgcol_hover' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_meta_bgcol_hover' );
|
||||
$classname = 'main-meta-bgcol-hover-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_meta_textcol' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_meta_textcol' );
|
||||
$classname = 'main-meta-textcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_meta_textcol_hover' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_meta_textcol_hover' );
|
||||
$classname = 'main-meta-textcol-hover-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_table_textcol' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_table_textcol' );
|
||||
$classname = 'main-table-textcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_table_bgcol' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_table_bgcol' );
|
||||
$classname = 'main-table-bgcol-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_table_bgcol_header' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_table_bgcol_header' );
|
||||
$classname = 'main-table-bgcol-head-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
if ('' != get_theme_mod( 'pirate_rogue_main_table_bgcol_oddrows' ) ) {
|
||||
$val = get_theme_mod( 'pirate_rogue_main_table_bgcol_oddrows' );
|
||||
$classname = 'main-table-bgcol-odd-'.$val;
|
||||
$classes[] = $classname;
|
||||
}
|
||||
|
||||
if ('' != get_theme_mod( 'pirate_rogue_shadow_images' ) ) {
|
||||
$classes[] = 'shadow-images';
|
||||
}
|
||||
if (get_theme_mod( 'pirate_rogue_h1noupper' ) ) {
|
||||
$classes[] = 'h1noupper';
|
||||
}
|
||||
|
||||
|
||||
// Additional body classes for WooCommerce
|
||||
if ( is_active_sidebar( 'sidebar-shop' )) {
|
||||
$classes[] = 'sidebar-shop';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
add_filter( 'body_class', 'pirate_rogue_body_class' );
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* make links relative
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_make_link_relative($url) {
|
||||
$current_site_url = get_site_url();
|
||||
if (!empty($GLOBALS['_wp_switched_stack'])) {
|
||||
$switched_stack = $GLOBALS['_wp_switched_stack'];
|
||||
$blog_id = end($switched_stack);
|
||||
if ($GLOBALS['blog_id'] != $blog_id) {
|
||||
$current_site_url = get_site_url($blog_id);
|
||||
}
|
||||
}
|
||||
$current_host = parse_url($current_site_url, PHP_URL_HOST);
|
||||
$host = parse_url($url, PHP_URL_HOST);
|
||||
if($current_host == $host) {
|
||||
$url = wp_make_link_relative($url);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Add a special walker for the main menu, allowing us, to add some stuff :)
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
class Pirate_Rogue_Menu_Walker extends Walker_Nav_Menu {
|
||||
public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
|
||||
if ( '-' === $item->title ) {
|
||||
$item_output = '<li class="menu_separator"><hr>';
|
||||
} else {
|
||||
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
||||
|
||||
$class_names = $attributes = '';
|
||||
|
||||
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
|
||||
$ariapopup = '';
|
||||
$rellink = '';
|
||||
if (!empty($item->url)) {
|
||||
$rellink = pirate_rogue_make_link_relative($item->url);
|
||||
if (substr($rellink,0,4) == 'http') {
|
||||
// absoluter Link auf externe Seite
|
||||
$classes[] = 'external';
|
||||
} elseif ($rellink == '/') {
|
||||
// Link auf Startseite
|
||||
$classes[] = 'homelink';
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array('has_children', $classes)) {
|
||||
$ariapopup = ' aria-haspopup="true"';
|
||||
}
|
||||
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
|
||||
$class_names = ' class="'. esc_attr( $class_names ) . '"';
|
||||
|
||||
$output .= $indent . '<li' . $class_names .$ariapopup.'>';
|
||||
|
||||
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
|
||||
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
|
||||
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
|
||||
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
|
||||
$description = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : '';
|
||||
|
||||
if($depth != 0) {
|
||||
$description = "";
|
||||
}
|
||||
$item_output = '';
|
||||
if (!empty($attributes)) {
|
||||
if (!empty($args->before))
|
||||
$item_output .= $args->before;
|
||||
$item_output .= '<a'. $attributes .'>';
|
||||
|
||||
if (!empty($args->link_before))
|
||||
$item_output .= $args->link_before;
|
||||
|
||||
$item_output .= apply_filters( 'the_title', $item->title, $item->ID );
|
||||
$item_output .= $description;
|
||||
|
||||
if (!empty($args->link_after))
|
||||
$item_output .= $args->link_after;
|
||||
|
||||
$item_output .= '</a>';
|
||||
|
||||
if (!empty($args->after))
|
||||
$item_output .= $args->after;
|
||||
}
|
||||
}
|
||||
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
||||
}
|
||||
public function display_element($el, &$children, $max_depth, $depth = 0, $args = array(), &$output){
|
||||
$id = $this->db_fields['id'];
|
||||
if(isset($children[$el->$id]))
|
||||
$el->classes[] = 'has_children';
|
||||
|
||||
parent::display_element($el, $children, $max_depth, $depth, $args, $output);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Add a special walker for the main menu, allowing us, to add some stuff :)
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
class Pirate_Rogue_OverlayMenu_Walker extends Walker_Nav_Menu {
|
||||
public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
|
||||
if ( '-' === $item->title ) {
|
||||
$item_output = '<li class="menu_separator">';
|
||||
} else {
|
||||
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
||||
|
||||
$class_names = $attributes = '';
|
||||
|
||||
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
|
||||
$ariapopup = '';
|
||||
if (in_array('has_children', $classes)) {
|
||||
$ariapopup = ' aria-haspopup="true"';
|
||||
}
|
||||
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
|
||||
$class_names = ' class="'. esc_attr( $class_names ) . '"';
|
||||
|
||||
$output .= $indent . '<li' . $class_names .$ariapopup.'>';
|
||||
|
||||
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
|
||||
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
|
||||
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
|
||||
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
|
||||
$description = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : '';
|
||||
|
||||
if($depth != 0) {
|
||||
$description = "";
|
||||
}
|
||||
$item_output = '';
|
||||
if (!empty($attributes)) {
|
||||
if (!empty($args->before))
|
||||
$item_output .= $args->before;
|
||||
$item_output .= '<a'. $attributes .'>';
|
||||
|
||||
if (!empty($args->link_before))
|
||||
$item_output .= $args->link_before;
|
||||
|
||||
$item_output .= apply_filters( 'the_title', $item->title, $item->ID );
|
||||
$item_output .= $description;
|
||||
|
||||
if (!empty($args->link_after))
|
||||
$item_output .= $args->link_after;
|
||||
|
||||
$item_output .= '</a>';
|
||||
|
||||
if (!empty($args->after))
|
||||
$item_output .= $args->after;
|
||||
}
|
||||
}
|
||||
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
||||
}
|
||||
public function display_element($el, &$children, $max_depth, $depth = 0, $args = array(), &$output){
|
||||
$id = $this->db_fields['id'];
|
||||
if(isset($children[$el->$id]))
|
||||
$el->classes[] = 'has_children';
|
||||
|
||||
parent::display_element($el, $children, $max_depth, $depth, $args, $output);
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Get Image Meta Data
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_get_image_attributs($id=0) {
|
||||
$precopyright = '';
|
||||
if ($id==0) return;
|
||||
|
||||
$meta = get_post_meta( $id );
|
||||
if (!isset($meta)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$image = wp_get_attachment_image_src($id, 'full');
|
||||
list($src, $width, $height) = $image;
|
||||
$hwstring = image_hwstring($width, $height);
|
||||
$result['src'] = $src;
|
||||
$result['hwstring'] = $hwstring;
|
||||
$result['width'] = $width;
|
||||
$result['height'] = $height;
|
||||
|
||||
|
||||
if (isset($meta['_wp_attachment_image_alt'][0])) {
|
||||
$result['alt'] = trim(strip_tags($meta['_wp_attachment_image_alt'][0]));
|
||||
} else {
|
||||
$result['alt'] = "";
|
||||
}
|
||||
|
||||
if (isset($meta['_wp_attachment_metadata']) && is_array($meta['_wp_attachment_metadata'])) {
|
||||
$data = unserialize($meta['_wp_attachment_metadata'][0]);
|
||||
if (isset($data['image_meta']) && is_array($data['image_meta'])) {
|
||||
if (isset($data['image_meta']['copyright'])) {
|
||||
$result['copyright'] = trim(strip_tags($data['image_meta']['copyright']));
|
||||
}
|
||||
if (isset($data['image_meta']['author'])) {
|
||||
$result['author'] = trim(strip_tags($data['image_meta']['author']));
|
||||
} elseif (isset($data['image_meta']['credit'])) {
|
||||
$result['credit'] = trim(strip_tags($data['image_meta']['credit']));
|
||||
}
|
||||
if (isset($data['image_meta']['title'])) {
|
||||
$result['title'] = $data['image_meta']['title'];
|
||||
}
|
||||
if (isset($data['image_meta']['caption'])) {
|
||||
$result['caption'] = $data['image_meta']['caption'];
|
||||
}
|
||||
}
|
||||
$result['orig_width'] = $data['width'];
|
||||
$result['orig_height'] = $data['height'];
|
||||
$result['orig_file'] = $data['file'];
|
||||
|
||||
}
|
||||
|
||||
$attachment = get_post($id);
|
||||
if (isset($attachment) ) {
|
||||
if (isset($attachment->post_excerpt)) {
|
||||
$result['excerpt'] = trim(strip_tags( $attachment->post_excerpt ));
|
||||
}
|
||||
if (isset($attachment->post_content)) {
|
||||
$result['description'] = trim(strip_tags( $attachment->post_content ));
|
||||
}
|
||||
if (isset($attachment->post_title) && (empty( $result['title']))) {
|
||||
$result['title'] = trim(strip_tags( $attachment->post_title ));
|
||||
}
|
||||
}
|
||||
$result['credits'] = '';
|
||||
|
||||
|
||||
|
||||
if (!empty($result['copyright'])) {
|
||||
$result['credits'] = $precopyright.' '.$result['copyright'];
|
||||
} elseif (!empty($result['author'])) {
|
||||
$result['credits'] = $precopyright.' '.$result['author'];
|
||||
} elseif (!empty($result['credit'])) {
|
||||
$result['credits'] = $precopyright.' '.$result['credit'];
|
||||
} else {
|
||||
if (!empty($result['caption'])) {
|
||||
$result['credits'] = $result['caption'];
|
||||
} elseif (!empty($result['excerpt'])) {
|
||||
$result['credits'] = $result['excerpt'];
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Returns an array as table
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_array2table($array, $table = true) {
|
||||
$out = '';
|
||||
$tableHeader = '';
|
||||
foreach ($array as $key => $value) {
|
||||
$out .= '<tr>';
|
||||
$out .= "<th>$key</th>";
|
||||
if (is_array($value)) {
|
||||
if (!isset($tableHeader)) {
|
||||
$tableHeader =
|
||||
'<th>' .
|
||||
implode('</th><th>', array_keys($value)) .
|
||||
'</th>';
|
||||
}
|
||||
array_keys($value);
|
||||
$out .= "<td>";
|
||||
$out .= pirate_rogue_array2table($value, true);
|
||||
$out .= "</td>";
|
||||
} else {
|
||||
$out .= "<td>$value</td>";
|
||||
}
|
||||
$out .= '</tr>';
|
||||
}
|
||||
|
||||
if ($table) {
|
||||
return '<table>' . $tableHeader . $out . '</table>';
|
||||
} else {
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Create String for Publisher Info, used by Schema.org Microformat Data
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_create_schema_publisher($withrahmen = true) {
|
||||
$out = $src = $width = $height = '';
|
||||
if ($withrahmen) {
|
||||
$out .= '<div itemprop="publisher" itemscope itemtype="https://schema.org/Organization">';
|
||||
}
|
||||
$header_image = get_header_image();
|
||||
if ($header_image) {
|
||||
$src = esc_url( $header_image );
|
||||
$width = get_custom_header()->width;
|
||||
$height = get_custom_header()->height;
|
||||
} else {
|
||||
$custom_logo_id = get_theme_mod( 'custom_logo' );
|
||||
if ( $custom_logo_id ) {
|
||||
$image = wp_get_attachment_image_src($custom_logo_id, 'full');
|
||||
if ( $image ) {
|
||||
list($src, $width, $height) = $image;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($src) {
|
||||
$out .= '<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">';
|
||||
$out .= '<link itemprop="contentUrl url" href="'.$src.'">';
|
||||
$out .= '<meta itemprop="width" content="'.$width.'">';
|
||||
$out .= '<meta itemprop="height" content="'.$height.'">';
|
||||
$out .= '</div>';
|
||||
}
|
||||
$out .= '<meta itemprop="name" content="'.get_bloginfo( 'name' ).'">';
|
||||
$out .= '<link itemprop="url" href="'.home_url( '/' ).'">';
|
||||
if ($withrahmen) {
|
||||
$out .= '</div>';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Create String for Thumbnail info, used by Schema.org Microformat Data
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_create_schema_thumbnail($id = 0) {
|
||||
$output = "";
|
||||
if (!$id) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
$post_thumbnail_id = get_post_thumbnail_id( $id );
|
||||
if (!$post_thumbnail_id) {
|
||||
$thumbfallbackid = get_theme_mod( 'pirate_rogue_fallback_blogroll_thumbnail' );
|
||||
if ($thumbfallbackid) {
|
||||
$post_thumbnail_id = $thumbfallbackid;
|
||||
}
|
||||
}
|
||||
|
||||
if ($post_thumbnail_id) {
|
||||
$thumbimage = wp_get_attachment_image_src( $post_thumbnail_id);
|
||||
$image = wp_get_attachment_image_src( $post_thumbnail_id, 'full');
|
||||
$imageurl = $image[0];
|
||||
$imgwidth = $image[1];
|
||||
$imgheight = $image[2];
|
||||
$output .= '<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">';
|
||||
$output .= '<link itemprop="thumbnailUrl" href="'.esc_url($thumbimage[0]).'">';
|
||||
$output .= '<link itemprop="contentUrl url" href="'.esc_url($imageurl).'">';
|
||||
$output .= '<meta itemprop="width" content="'.$imgwidth.'">';
|
||||
$output .= '<meta itemprop="height" content="'.$imgheight.'">';
|
||||
$output .= '</div>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Create String for info about post date and author, used by Schema.org Microformat Data
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_create_schema_postmeta($id = 0) {
|
||||
$output = "";
|
||||
if (!$id) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
$output .= '<meta itemprop="datePublished" content="'.esc_attr( get_post_time('c', false, $id) ).'">';
|
||||
$output .= '<meta itemprop="dateModified" content="'.esc_attr( get_the_modified_time('c', false, $id) ).'">';
|
||||
|
||||
$author = get_theme_mod( 'pirate_rogue_author' );
|
||||
if (!$author) {
|
||||
$author_id = get_post_field('post_author', $id);
|
||||
$author = get_the_author_meta( 'display_name' , $author_id );
|
||||
}
|
||||
$output .= '<div itemprop="author" itemscope itemtype="http://schema.org/Person">';
|
||||
$output .= '<meta itemprop="name" content="'.$author.'">';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Change output for gallery
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
add_filter('post_gallery', 'pirate_rogue_post_gallery', 10, 2);
|
||||
function pirate_rogue_post_gallery($output, $attr) {
|
||||
global $post;
|
||||
global $options;
|
||||
|
||||
if (isset($attr['orderby'])) {
|
||||
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
|
||||
if (!$attr['orderby'])
|
||||
unset($attr['orderby']);
|
||||
}
|
||||
|
||||
extract(shortcode_atts(array(
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'menu_order ID',
|
||||
'id' => $post->ID,
|
||||
'itemtag' => 'dl',
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'columns' => 3,
|
||||
'size' => 'thumbnail',
|
||||
'include' => '',
|
||||
'exclude' => '',
|
||||
'type' => NULL,
|
||||
'lightbox' => FALSE,
|
||||
'captions' => 1,
|
||||
'columns' => 6,
|
||||
'link' => 'file'
|
||||
|
||||
), $attr));
|
||||
|
||||
$id = intval($id);
|
||||
if ('RAND' == $order) $orderby = 'none';
|
||||
|
||||
if (!empty($include)) {
|
||||
$include = preg_replace('/[^0-9,]+/', '', $include);
|
||||
$_attachments = get_posts(
|
||||
array('include' => $include,
|
||||
'post_status' => 'inherit',
|
||||
'post_type' => 'attachment',
|
||||
'post_mime_type' => 'image',
|
||||
'order' => $order,
|
||||
'orderby' => $orderby)
|
||||
);
|
||||
|
||||
$attachments = array();
|
||||
foreach ($_attachments as $key => $val) {
|
||||
$attachments[$val->ID] = $_attachments[$key];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($attachments)) return '';
|
||||
|
||||
|
||||
$output = '';
|
||||
if (!isset($attr['captions'])) {
|
||||
$attr['captions'] =1;
|
||||
}
|
||||
if (!isset($attr['columns'])) {
|
||||
$attr['columns'] = 7;
|
||||
}
|
||||
if (!isset($attr['type'])) {
|
||||
$attr['type'] = 'default';
|
||||
}
|
||||
if (!isset($attr['link'])) {
|
||||
$attr['link'] = 'file';
|
||||
}
|
||||
|
||||
|
||||
wp_enqueue_script( 'pirate-rogue-slick' );
|
||||
$rand = rand();
|
||||
$output .= "<div id=\"slider-$rand\" class=\"gallery\">\n";
|
||||
$output .= "<div class=\"slider gallery-slider\">\n";
|
||||
foreach ($attachments as $id => $attachment) {
|
||||
$img = wp_get_attachment_image_src($id, 'pirate-rogue-gallery');
|
||||
$meta = pirate_rogue_get_image_attributs($id);
|
||||
//$meta = get_post($id);
|
||||
$img_full = wp_get_attachment_image_src($id, 'full');
|
||||
$output .= "\t".'<div><img src="'.esc_url($img[0]).'" width="'.$img[1].'" height="'.$img[2].'" alt="">';
|
||||
|
||||
$imgvar = "";
|
||||
if (isset($meta['title'])) {
|
||||
$imgvar = $meta['title'];
|
||||
}
|
||||
if ((empty($imgvar)) && (isset($meta['excerpt']))) {
|
||||
$imgvar = $meta['excerpt'];
|
||||
}
|
||||
if ((empty($imgvar)) && (isset($meta['caption']))) {
|
||||
$imgvar = $meta['caption'];
|
||||
}
|
||||
if ((empty($imgvar)) && (isset($meta['copyright']))) {
|
||||
$imgvar = $meta['copyright'];
|
||||
}
|
||||
|
||||
|
||||
$output .= '<div class="gallery-image-caption">';
|
||||
if (!empty($imgvar)) {
|
||||
$lightboxattr = '';
|
||||
$output .= $imgvar;
|
||||
if ((isset($meta['copyright'])) && ($imgvar !== $meta['copyright'])) {
|
||||
$output .= "<br>".$meta['copyright'];
|
||||
}
|
||||
}
|
||||
if ($attr['link'] != 'none') {
|
||||
$lightboxtitle = sanitize_text_field($imgvar);
|
||||
if (strlen(trim($lightboxtitle))>1) {
|
||||
$lightboxattr = ' title="'.$lightboxtitle.'"';
|
||||
}
|
||||
if (!empty($imgvar)) { $output .= '<br>'; }
|
||||
$output .= '<span class="linkorigin">(<a href="'.esc_url($img_full[0]).'" '.$lightboxattr.' class="lightbox" rel="lightbox-'.$rand.'">'.__('Full Size','pirate-rogue').'</a>)</span>';
|
||||
}
|
||||
|
||||
$output .='</div>';
|
||||
$output .= '</div>'."\n";
|
||||
}
|
||||
$output .= "</div>\n";
|
||||
$output .= "<script type=\"text/javascript\"> jQuery(document).ready(function($) {";
|
||||
$output .= "$('.gallery-slider').slick({
|
||||
centerMode: true,
|
||||
centerPadding: '60px',
|
||||
dots: true,
|
||||
infinite: true,
|
||||
speed: 500,
|
||||
fade: true,
|
||||
arrows: true,
|
||||
adaptiveHeight: true,
|
||||
swipe: true,
|
||||
draggable: true,
|
||||
accessibility: true,
|
||||
});";
|
||||
$output .= "});</script>";
|
||||
$output .= "</div>\n";
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* EOF
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
564
wp-content/themes/Pirate-Rogue/inc/template-tags.php
Normal file
564
wp-content/themes/Pirate-Rogue/inc/template-tags.php
Normal file
@@ -0,0 +1,564 @@
|
||||
<?php
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Custom Pirate Rogue template tags: Functions for templates and output
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_load_template_part($template_name, $part_name=null) {
|
||||
ob_start();
|
||||
get_template_part($template_name, $part_name);
|
||||
$var = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $var;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Get cat id by name or slug
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_get_cat_ID($string) {
|
||||
if (empty($string)) {
|
||||
return 0;
|
||||
}
|
||||
$string= esc_attr( $string );
|
||||
if (is_string($string)) {
|
||||
$thisid = get_cat_ID($string);
|
||||
if ($thisid==0) {
|
||||
$idObj = get_category_by_slug( $string );
|
||||
if (false==$idObj) {
|
||||
return 0;
|
||||
}
|
||||
$thisid = $idObj->term_id;
|
||||
}
|
||||
return $thisid;
|
||||
} elseif(is_numeric($string)) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Get tag id
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function pirate_rogue_get_tag_ID($tag_name) {
|
||||
$tag = get_term_by('name', $tag_name, 'post_tag');
|
||||
if ($tag) {
|
||||
return $tag->term_id;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Display blog entries with like front section bottom (1 / 3 sized)
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_section_featured_1to3' ) ) :
|
||||
function pirate_rogue_section_featured_1to3($posttag = '', $postcat = '', $title = '', $num = 8, $htmlid = '', $divclass= '') {
|
||||
$posttag = $posttag ? esc_attr( $posttag ) : '';
|
||||
|
||||
if (is_string($posttag)) {
|
||||
$posttag = pirate_rogue_get_tag_ID($posttag);
|
||||
}
|
||||
|
||||
|
||||
if ($posttag=='') {
|
||||
$posttag = get_theme_mod('pirate_rogue_front_section_two_tag');
|
||||
} elseif ($posttag == '-') {
|
||||
$posttag = 0;
|
||||
}
|
||||
$postcat = pirate_rogue_get_cat_ID($postcat);
|
||||
|
||||
if ($postcat==0) {
|
||||
$postcat = get_theme_mod('pirate_rogue_front_section_two_cat');
|
||||
}
|
||||
if (!isset($postcat) && !isset($posttag)) {
|
||||
return;
|
||||
}
|
||||
$title = $title ? esc_attr( $title ) : '';
|
||||
if (empty($title)) {
|
||||
if ( '' != get_theme_mod( 'pirate_rogue_front_section_two_title' )) {
|
||||
$title = esc_html( get_theme_mod( 'pirate_rogue_front_section_two_title' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_int($num)) {
|
||||
$num = 8;
|
||||
}
|
||||
$divclass = $divclass ? esc_attr( $divclass ) : '';
|
||||
|
||||
|
||||
$tag_link = get_tag_link( $posttag );
|
||||
$category_link = get_category_link($postcat);
|
||||
|
||||
$pirate_rogue_section_two_first_query = new WP_Query( array(
|
||||
'posts_per_page' => 1,
|
||||
'post_status' => 'publish',
|
||||
'tag_id' => $posttag,
|
||||
'cat' => $postcat,
|
||||
'ignore_sticky_posts' => 1,
|
||||
) );
|
||||
|
||||
|
||||
$args = array(
|
||||
'posts_per_page' => $num,
|
||||
'offset' => 1,
|
||||
'post_status' => 'publish',
|
||||
'tag_id' => $posttag,
|
||||
'cat' => $postcat,
|
||||
'ignore_sticky_posts' => 1,
|
||||
);
|
||||
$pirate_rogue_section_two_second_query = new WP_Query( $args );
|
||||
|
||||
$htmlid = $htmlid ? esc_attr( $htmlid ) : 'page-section-two';
|
||||
$out = '<section id="'.$htmlid.'" class="cf '.$divclass.'">';
|
||||
if (!empty($title)) {
|
||||
if (!empty($postcat)) {
|
||||
$out .= '<h3 class="front-section-title">'.esc_html( $title ).'<span><a class="all-posts-link" href="'.esc_url( $category_link ).'">'.__('All posts', 'pirate-rogue').'</a></span></h3>'."\n";
|
||||
} else {
|
||||
$out .= '<h3 class="front-section-title">'.esc_html( $title ).'<span><a class="all-posts-link" href="'.esc_url( $tag_link ).'">'.__('All posts', 'pirate-rogue').'</a></span></h3>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$out .= '<div class="section-two-column-one">'."\n";
|
||||
if($pirate_rogue_section_two_first_query->have_posts()) :
|
||||
while($pirate_rogue_section_two_first_query->have_posts()) : $pirate_rogue_section_two_first_query->the_post();
|
||||
$out .= pirate_rogue_load_template_part('template-parts/content-frontpost-big' );
|
||||
endwhile;
|
||||
|
||||
endif; // have_posts()
|
||||
|
||||
$out .= '</div><!-- end .section-two-column-one -->'."\n";
|
||||
$out .= '<div class="section-two-column-two columns-wrap">'."\n";
|
||||
if($pirate_rogue_section_two_second_query->have_posts()) :
|
||||
while($pirate_rogue_section_two_second_query->have_posts()) : $pirate_rogue_section_two_second_query->the_post();
|
||||
$out .= pirate_rogue_load_template_part('template-parts/content-frontpost-small' );
|
||||
endwhile;
|
||||
|
||||
endif; // have_posts()
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$out .= '</div><!-- end .section-two-column-two -->'."\n";
|
||||
$out .= '</section><!-- end #front-section-two -->'."\n";
|
||||
return $out;
|
||||
}
|
||||
endif;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Display blog entries with like front section bottom (3 / 1 sized)
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_section_featured_3to1' ) ) :
|
||||
function pirate_rogue_section_featured_3to1($posttag = '', $postcat = '', $title = '', $num = 5, $htmlid = '', $divclass= '') {
|
||||
$posttag = $posttag ? esc_attr( $posttag ) : '';
|
||||
|
||||
if (is_string($posttag)) {
|
||||
$posttag = pirate_rogue_get_tag_ID($posttag);
|
||||
}
|
||||
|
||||
|
||||
if ($posttag=='') {
|
||||
$posttag = get_theme_mod('uku_front_section_one_tag');
|
||||
} elseif ($posttag == '-') {
|
||||
$posttag = 0;
|
||||
}
|
||||
$postcat = pirate_rogue_get_cat_ID($postcat);
|
||||
|
||||
|
||||
if ($postcat==0) {
|
||||
$postcat = get_theme_mod('uku_front_section_one_cat');
|
||||
}
|
||||
if (!isset($postcat) && !isset($posttag)) {
|
||||
return;
|
||||
}
|
||||
$title = $title ? esc_attr( $title ) : '';
|
||||
if (empty($title)) {
|
||||
if ( '' != get_theme_mod( 'uku_front_section_one_title' )) {
|
||||
$title = esc_html( get_theme_mod( 'uku_front_section_one_title' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_int($num)) {
|
||||
$num = 5;
|
||||
}
|
||||
$divclass = $divclass ? esc_attr( $divclass ) : '';
|
||||
|
||||
|
||||
$tag_link = get_tag_link( $posttag );
|
||||
$category_link = get_category_link($postcat);
|
||||
|
||||
$pirate_rogue_section_two_first_query = new WP_Query( array(
|
||||
'posts_per_page' => 1,
|
||||
'post_status' => 'publish',
|
||||
'tag_id' => $posttag,
|
||||
'cat' => $postcat,
|
||||
'ignore_sticky_posts' => 1,
|
||||
) );
|
||||
|
||||
|
||||
$args = array(
|
||||
'posts_per_page' => $num,
|
||||
'offset' => 1,
|
||||
'post_status' => 'publish',
|
||||
'tag_id' => $posttag,
|
||||
'cat' => $postcat,
|
||||
'ignore_sticky_posts' => 1,
|
||||
);
|
||||
$pirate_rogue_section_two_second_query = new WP_Query( $args );
|
||||
|
||||
$htmlid = $htmlid ? esc_attr( $htmlid ) : 'page-section-one';
|
||||
$out = '<section id="'.$htmlid.'" class="cf '.$divclass.'">';
|
||||
if (!empty($title)) {
|
||||
if (!empty($postcat)) {
|
||||
$out .= '<h3 class="front-section-title">'.esc_html( $title ).'<span><a class="all-posts-link" href="'.esc_url( $category_link ).'">'.__('All posts', 'pirate-rogue').'</a></span></h3>'."\n";
|
||||
} else {
|
||||
$out .= '<h3 class="front-section-title">'.esc_html( $title ).'<span><a class="all-posts-link" href="'.esc_url( $tag_link ).'">'.__('All posts', 'pirate-rogue').'</a></span></h3>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$out .= '<div class="section-one-column-one">'."\n";
|
||||
if($pirate_rogue_section_two_first_query->have_posts()) :
|
||||
while($pirate_rogue_section_two_first_query->have_posts()) : $pirate_rogue_section_two_first_query->the_post();
|
||||
$out .= pirate_rogue_load_template_part('template-parts/content-frontpost-big' );
|
||||
endwhile;
|
||||
|
||||
endif; // have_posts()
|
||||
|
||||
$out .= '</div><!-- end .section-one-column-one -->'."\n";
|
||||
$out .= '<div class="section-one-column-two columns-wrap">'."\n";
|
||||
if($pirate_rogue_section_two_second_query->have_posts()) :
|
||||
while($pirate_rogue_section_two_second_query->have_posts()) : $pirate_rogue_section_two_second_query->the_post();
|
||||
$out .= pirate_rogue_load_template_part('template-parts/content-frontpost-small' );
|
||||
endwhile;
|
||||
|
||||
endif; // have_posts()
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
$out .= '</div><!-- end .section-one-column-two -->'."\n";
|
||||
$out .= '</section>'."\n";
|
||||
return $out;
|
||||
}
|
||||
endif;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Display blog entries in two columns display
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_section_twocolumn' ) ) :
|
||||
function pirate_rogue_section_twocolumn($posttag = '', $postcat = '', $title = '', $num = 4, $divclass= '') {
|
||||
$posttag = $posttag ? esc_attr( $posttag ) : '';
|
||||
|
||||
if (is_string($posttag)) {
|
||||
$posttag = pirate_rogue_get_tag_ID($posttag);
|
||||
}
|
||||
|
||||
|
||||
if ($posttag=='') {
|
||||
$posttag = get_theme_mod('pirate_rogue_front_section_twocolumn_tag');
|
||||
} elseif ($posttag == '-') {
|
||||
$posttag = 0;
|
||||
}
|
||||
$postcat = pirate_rogue_get_cat_ID($postcat);
|
||||
if ($postcat==0) {
|
||||
$postcat = get_theme_mod('pirate_rogue_front_section_twocolumn_cat');
|
||||
}
|
||||
if (!isset($postcat) && !isset($posttag)) {
|
||||
return;
|
||||
}
|
||||
$title = $title ? esc_attr( $title ) : '';
|
||||
if (empty($title)) {
|
||||
if ( '' != get_theme_mod( 'pirate_rogue_front_section_twocolumn_title' )) {
|
||||
$title = esc_html( get_theme_mod( 'pirate_rogue_front_section_twocolumn_title' ) );
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_int($num)) {
|
||||
$num =4;
|
||||
}
|
||||
$divclass = $divclass ? esc_attr( $divclass ) : '';
|
||||
|
||||
|
||||
$tag_link = get_tag_link( $posttag );
|
||||
$category_link = get_category_link($postcat);
|
||||
|
||||
$pirate_rogue_section_twocolumn_query = new WP_Query( array(
|
||||
'posts_per_page' => $num,
|
||||
'tag_id' => $posttag,
|
||||
'cat' => $postcat,
|
||||
'post_status' => 'publish',
|
||||
'ignore_sticky_posts' => 1,
|
||||
) );
|
||||
|
||||
$thumbfallbackid = absint(get_theme_mod( 'pirate_rogue_fallback_thumbnail' ));
|
||||
if (!isset($thumbfallbackid)) {
|
||||
$thumbfallbackid =0;
|
||||
} else {
|
||||
$imagesrc = wp_get_attachment_image_src( $thumbfallbackid, 'pirate-rogue-front-big' )[0];
|
||||
}
|
||||
|
||||
$out = '<section id="front-section-twocolumn" class="cf columns-wrap '.$divclass.'">';
|
||||
if (!empty($title)) {
|
||||
if (!empty($postcat)) {
|
||||
$out .= '<h3 class="front-section-title">'.esc_html( $title ).'<span><a class="all-posts-link" href="'.esc_url( $category_link ).'">'.__('All posts', 'pirate-rogue').'</a></span></h3>'."\n";
|
||||
} else {
|
||||
$out .= '<h3 class="front-section-title">'.esc_html( $title ).'<span><a class="all-posts-link" href="'.esc_url( $tag_link ).'">'.__('All posts', 'pirate-rogue').'</a></span></h3>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if($pirate_rogue_section_twocolumn_query->have_posts()) :
|
||||
while($pirate_rogue_section_twocolumn_query->have_posts()) :
|
||||
$pirate_rogue_section_twocolumn_query->the_post();
|
||||
|
||||
$out .= '<article class="'. join( ' ', get_post_class() ) .'">';
|
||||
|
||||
if ( '' != get_the_post_thumbnail() && ! post_password_required() ) :
|
||||
$out .= '<div class="entry-thumbnail fadein"><a href="'.get_permalink().'"><span class="thumb-wrap">'.get_the_post_thumbnail('pirate-rogue-front-big').'</span></a></div><!-- end .entry-thumbnail -->'."\n";
|
||||
elseif ( ! post_password_required() && $imagesrc != '') :
|
||||
$out .= '<div class="entry-thumbnail fadein"><a href="'.get_permalink().'"><span class="thumb-wrap"><img src="'.$imagesrc.'"></span></a></div><!-- end .entry-thumbnail -->'."\n";
|
||||
endif;
|
||||
|
||||
$out .= '<header class="entry-header">'."\n";
|
||||
$out .= '<div class="entry-cats">'."\n";
|
||||
|
||||
$categories = get_the_category();
|
||||
$separator = ' ';
|
||||
if ( ! empty( $categories ) ) {
|
||||
foreach( $categories as $category ) {
|
||||
$out .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$out .= '</div><!-- end .entry-cats -->'."\n";
|
||||
$out .= '<h2 class="entry-title"><a href="'.esc_url( get_permalink() ).'" rel="bookmark">';
|
||||
$out .= get_the_title();
|
||||
$out .= '</a><span class="screen-reader-text"> ('. get_the_date().')</span></h2>';
|
||||
|
||||
|
||||
$out .= '</header><!-- end .entry-header -->'."\n";
|
||||
|
||||
$out .= '<div class="entry-summary">'."\n";
|
||||
$out .= get_the_excerpt();
|
||||
$out .= '</div><!-- end .entry-summary -->'."\n";
|
||||
$out .= '</article><!-- #post-## -->'."\n";
|
||||
|
||||
endwhile;
|
||||
endif; // have_posts()
|
||||
wp_reset_postdata();
|
||||
|
||||
$out .= '</section>'."\n";
|
||||
return $out;
|
||||
}
|
||||
endif;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Display blog entries as blogroll
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_blogroll' ) ) :
|
||||
function pirate_rogue_blogroll($posttag = '', $postcat = '', $num = 4, $divclass= '') {
|
||||
$posttag = $posttag ? esc_attr( $posttag ) : '';
|
||||
|
||||
|
||||
if ((!isset($posttag)) && (!isset($postcat))) {
|
||||
// kein wert gesetzt, also nehm ich die letzten Artikel
|
||||
$postcat =0;
|
||||
} else {
|
||||
if (is_string($posttag)) {
|
||||
$posttag = pirate_rogue_get_tag_ID($posttag);
|
||||
}
|
||||
$postcat = pirate_rogue_get_cat_ID($postcat);
|
||||
}
|
||||
|
||||
if (!is_int($num)) {
|
||||
$num = 4;
|
||||
}
|
||||
$divclass = $divclass ? esc_attr( $divclass ) : '';
|
||||
|
||||
$parameter = array(
|
||||
'posts_per_page' => $num,
|
||||
'post_status' => 'publish',
|
||||
'ignore_sticky_posts' => 1,
|
||||
);
|
||||
$found = 0;
|
||||
if ((isset($posttag)) && ($posttag >= 0)) {
|
||||
$parameter['tag_id'] = $posttag;
|
||||
$found =1;
|
||||
}
|
||||
if ((isset($postcat)) && ($postcat >= 0)) {
|
||||
$parameter['cat'] = $postcat;
|
||||
$found =2;
|
||||
}
|
||||
if ($found==0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pirate_rogue_blogroll_query = new WP_Query($parameter );
|
||||
$out = '<section class="blogroll '.$divclass.'">';
|
||||
if($pirate_rogue_blogroll_query->have_posts()) :
|
||||
while($pirate_rogue_blogroll_query->have_posts()) :
|
||||
$pirate_rogue_blogroll_query->the_post();
|
||||
$out .= pirate_rogue_load_template_part('template-parts/content-blogroll' );
|
||||
endwhile;
|
||||
endif; // have_posts()
|
||||
|
||||
wp_reset_postdata();
|
||||
$out .= '</section>'."\n";
|
||||
return $out;
|
||||
}
|
||||
endif;
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Display blog entries as list
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_articlelist' ) ) :
|
||||
function pirate_rogue_articlelist($posttag = '', $postcat = '', $num = 5, $divclass= '', $title = '') {
|
||||
$posttag = $posttag ? esc_attr( $posttag ) : '';
|
||||
|
||||
if ((!isset($posttag)) && (!isset($postcat))) {
|
||||
// kein wert gesetzt, also nehm ich die letzten Artikel
|
||||
$postcat =0;
|
||||
} else {
|
||||
if (is_string($posttag)) {
|
||||
$posttag = pirate_rogue_get_tag_ID($posttag);
|
||||
}
|
||||
$postcat = pirate_rogue_get_cat_ID($postcat);
|
||||
}
|
||||
|
||||
if (!is_int($num)) {
|
||||
$num = 5;
|
||||
}
|
||||
$divclass = $divclass ? esc_attr( $divclass ) : '';
|
||||
|
||||
$parameter = array(
|
||||
'posts_per_page' => $num,
|
||||
'post_status' => 'publish',
|
||||
'ignore_sticky_posts' => 1,
|
||||
);
|
||||
$found = 0;
|
||||
if ((isset($posttag)) && ($posttag >= 0)) {
|
||||
$parameter['tag_id'] = $posttag;
|
||||
$found =1;
|
||||
}
|
||||
if ((isset($postcat)) && ($postcat >= 0)) {
|
||||
$parameter['cat'] = $postcat;
|
||||
$found =2;
|
||||
}
|
||||
if ($found==0) {
|
||||
return;
|
||||
}
|
||||
$pirate_rogue_blogroll_query = new WP_Query($parameter );
|
||||
|
||||
|
||||
$divclass = $divclass ? esc_attr( $divclass ) : '';
|
||||
$title = esc_attr( $title );
|
||||
|
||||
|
||||
$out ='';
|
||||
if (!empty($title)) {
|
||||
$out .= '<section class="section_articlelist"><h2>'.$title.'</h2>';
|
||||
}
|
||||
$out .= '<ul class="articlelist '.$divclass.'">';
|
||||
if($pirate_rogue_blogroll_query->have_posts()) :
|
||||
while($pirate_rogue_blogroll_query->have_posts()) :
|
||||
$pirate_rogue_blogroll_query->the_post();
|
||||
|
||||
$out .= '<li>';
|
||||
$out .= '<a href="'.esc_url( get_permalink() ).'">';
|
||||
$out .= get_the_title();
|
||||
$out .= '</a>';
|
||||
$out .= '</li>';
|
||||
endwhile;
|
||||
endif; // have_posts()
|
||||
|
||||
wp_reset_postdata();
|
||||
$out .= '</ul>'."\n";
|
||||
if (!empty($title)) {
|
||||
$out .= '</section>';
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
endif;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Prints HTML with meta information for the current post-date/time and author.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_posted_on' ) ) :
|
||||
function pirate_rogue_posted_on() {
|
||||
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
||||
|
||||
$time_string = sprintf( $time_string,
|
||||
esc_attr( get_the_date( 'c' ) ),
|
||||
esc_html( get_the_date() )
|
||||
);
|
||||
|
||||
$posted_on = sprintf(
|
||||
esc_html_x( '%s', 'post date', 'pirate-rogue'),
|
||||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
||||
);
|
||||
|
||||
$byline = sprintf(
|
||||
esc_html_x( '%s', 'post author', 'pirate-rogue'),
|
||||
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
||||
);
|
||||
|
||||
if (('' != get_theme_mod( 'pirate_rogue_front_hideauthor' ) ) || ('' != get_theme_mod( 'pirate_rogue_all_hideauthor' ) )) {
|
||||
/* Do not show author information */
|
||||
} else {
|
||||
echo '<div class="entry-author"> ' . $byline . '</div>';
|
||||
}
|
||||
|
||||
echo '<div class="entry-date">' . $posted_on . '</div>';
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Prints Post Author Information
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_posted_by' ) ) :
|
||||
function pirate_rogue_posted_by() {
|
||||
if (('' != get_theme_mod( 'pirate_rogue_front_hideauthor' ) ) || ('' != get_theme_mod( 'pirate_rogue_all_hideauthor' ) )) {
|
||||
return;
|
||||
}
|
||||
$byline = sprintf(
|
||||
/* translators: used to show post author name */
|
||||
esc_html_x( '%s', 'post author', 'pirate-rogue'),
|
||||
'<span class="author vcard"><a class="url" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html__( 'by ', 'pirate-rogue') . '<span class="fn n">' . esc_html( get_the_author() ) . '</span></a></span>'
|
||||
);
|
||||
|
||||
echo '<span class="entry-author"> ' . $byline . '</span>';
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Get special excerpt by content
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if ( ! function_exists( 'pirate_rogue_custom_excerpt' ) ) :
|
||||
function pirate_rogue_custom_excerpt($length = 400){
|
||||
$excerpt = get_the_content();
|
||||
|
||||
if ($length <=0) {
|
||||
$length = 100;
|
||||
}
|
||||
|
||||
$excerpt = preg_replace('/\s+(https?:\/\/www\.youtube[\/a-z0-9\.\-\?&;=_]+)/i','',$excerpt);
|
||||
$excerpt = strip_shortcodes($excerpt);
|
||||
$excerpt = strip_tags($excerpt, '<br>,<br />,<b>,</b>,<strong>,</strong>,<em>,</em>');
|
||||
|
||||
|
||||
if (mb_strlen($excerpt)<5) {
|
||||
$excerpt = '<!-- '.__( 'No entry for this post', 'pirate-rogue' ).' -->';
|
||||
}
|
||||
|
||||
$needcontinue =0;
|
||||
if (mb_strlen($excerpt) > $length) {
|
||||
$the_str = mb_substr($excerpt, 0, $length);
|
||||
$the_str .= "...";
|
||||
$needcontinue = 1;
|
||||
} else {
|
||||
$the_str = $excerpt;
|
||||
}
|
||||
$the_str = '<p>'.$the_str.'</p>';
|
||||
return $the_str;
|
||||
}
|
||||
endif;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* The end of this file as you know it
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
668
wp-content/themes/Pirate-Rogue/inc/xwolf-customizer.php
Normal file
668
wp-content/themes/Pirate-Rogue/inc/xwolf-customizer.php
Normal file
@@ -0,0 +1,668 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Wrapper for customizer by xwolf
|
||||
* All options in customizer are generated by an array, which is somewhat
|
||||
* easer to edit.
|
||||
*
|
||||
* Alle options, which may to be changed are set in the array and ordered
|
||||
* by their tabs. (Only) If needed, additional JS and CSS is loaded in backend.
|
||||
*
|
||||
* Author: xwolf
|
||||
* Author URL: https://xwolf.de
|
||||
* Licence: GPL
|
||||
*
|
||||
* Proudly set under GPL. Feel free to use and change. Make the world
|
||||
* a better place by sharing ideas and code.
|
||||
*
|
||||
* Customizer-API:
|
||||
* @link http://codex.wordpress.org/Theme_Customization_API
|
||||
*/
|
||||
|
||||
/*
|
||||
$xwolf_customizer_setoptions = array(
|
||||
'my-panel-1' => array(
|
||||
'tabtitle' => __('My Panel 1'),
|
||||
'fields' => array(
|
||||
'my-section-1' => array(
|
||||
'type' => 'section',
|
||||
'title' => __( 'Section 1 in Panel 1' ),
|
||||
),
|
||||
'my-option-name'=> array(
|
||||
'type' => 'select',
|
||||
'title' => __( 'Typ' ),
|
||||
'label' => __( 'Select something' ),
|
||||
'liste' => array(
|
||||
0 => __('Element 1'),
|
||||
1 => __('Element 2'),
|
||||
2 => __('Element 3') ,
|
||||
3 => __('Element 4')
|
||||
),
|
||||
'default' => 'some value',
|
||||
'parent' => 'my-section-1'
|
||||
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
*/
|
||||
$xwolf_customizer_setoptions = $pirate_rogue_options;
|
||||
|
||||
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
// needed for options, that may be disabled, if a defined plugin is active
|
||||
|
||||
|
||||
add_action( 'customize_register', 'xwolf_customizer_settings' );
|
||||
function xwolf_customizer_settings( $wp_customize ) {
|
||||
global $xwolf_customizer_setoptions;
|
||||
// list of options, that may be changed
|
||||
|
||||
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
||||
$num = 0;
|
||||
|
||||
$definedtypes = array(
|
||||
"text", "checkbox", "radio", "select", "textarea", "dropdown-pages", "email", "url", "number", "hidden", "date",
|
||||
// defaults
|
||||
"bool", "html", "image", "multiselect", "range", "category", "tag", "toggle", "toggle-switch", "colorlist-radio"
|
||||
// special settings
|
||||
);
|
||||
|
||||
|
||||
foreach($xwolf_customizer_setoptions as $tab => $value) {
|
||||
$tabtitel = __($value['tabtitle'], 'pirate-rogue');
|
||||
|
||||
$desc = '';
|
||||
$capability = 'edit_theme_options';
|
||||
if (isset($value['capability']))
|
||||
$capability = $value['capability'];
|
||||
if (isset($value['desc']))
|
||||
$desc = __($value['desc'], 'pirate-rogue');
|
||||
|
||||
$num = $num +1;
|
||||
$wp_customize->add_panel( $tab, array(
|
||||
'priority' => $num,
|
||||
'capability' => $capability,
|
||||
'title' => $tabtitel,
|
||||
'description' => $desc,
|
||||
) );
|
||||
if (isset($xwolf_customizer_setoptions[$tab]['fields'])) {
|
||||
|
||||
$nosectionentries = array();
|
||||
$sectionprio = 0;
|
||||
foreach($xwolf_customizer_setoptions[$tab]['fields'] as $field => $value) {
|
||||
$sectionprio = $sectionprio +1;
|
||||
if ($value['type'] == 'section') {
|
||||
// Definition section
|
||||
$desc = '';
|
||||
$title = '';
|
||||
$capability = '';
|
||||
if (isset($value['capability']))
|
||||
$capability = $value['capability'];
|
||||
|
||||
$thisprio = $sectionprio;
|
||||
if (isset($value['priority']))
|
||||
$thisprio = $value['priority'];
|
||||
if (isset($value['title']))
|
||||
$title = __($value['title'], 'pirate-rogue');
|
||||
if (isset($value['desc']))
|
||||
$desc = __($value['desc'], 'pirate-rogue');
|
||||
|
||||
|
||||
$sectionid = esc_html($field);
|
||||
|
||||
$wp_customize->add_section( $sectionid , array(
|
||||
'title' => $title,
|
||||
'description' => $desc,
|
||||
'panel' => $tab,
|
||||
'capability' => $capability,
|
||||
'priority' => $thisprio,
|
||||
) );
|
||||
|
||||
}
|
||||
}
|
||||
$sectionprio = $sectionprio +1;
|
||||
$sectionid = $tab."-elsesection";
|
||||
$wp_customize->add_section( $sectionid , array(
|
||||
'title' => __('Miscellaneous'),
|
||||
'panel' => $tab,
|
||||
'priority' => $sectionprio,
|
||||
) );
|
||||
// Add a section for all options, that were not defined within a section
|
||||
// (Mostly forgotten)
|
||||
|
||||
foreach($xwolf_customizer_setoptions[$tab]['fields'] as $field => $value) {
|
||||
if ($value['type'] != 'section') {
|
||||
if (isset($value['parent'])) {
|
||||
$section = $value['parent'];
|
||||
} else {
|
||||
$section = $tab."-elsesection";
|
||||
}
|
||||
|
||||
$default = $title = $desc = $label = $type = '';
|
||||
$notifplugin = $ifplugin = $ifclassexists = $iffunctionexists = '';
|
||||
$optionid = esc_html($field);
|
||||
|
||||
if (isset($value['title']))
|
||||
$title = __($value['title'], 'pirate-rogue');
|
||||
if (isset($value['desc']))
|
||||
$desc = __($value['desc'], 'pirate-rogue');
|
||||
if (isset($value['label']))
|
||||
$label = __($value['label'], 'pirate-rogue');
|
||||
if (isset($value['notifplugin']))
|
||||
$notifplugin = $value['notifplugin'];
|
||||
if (isset($value['ifplugin']))
|
||||
$ifplugin = $value['ifplugin'];
|
||||
if (isset($value['ifclass']))
|
||||
$ifclassexists = $value['ifclass'];
|
||||
if (isset($value['iffunction']))
|
||||
$iffunctionexists = $value['iffunction'];
|
||||
if (isset($value['default'])) {
|
||||
$default = $value['default'];
|
||||
}
|
||||
|
||||
|
||||
$type = $value['type'];
|
||||
if (!in_array($type, $definedtypes)) {
|
||||
|
||||
$default = "UNDEFINED TYP";
|
||||
$label = $label . " ( UNDEFINED TYP: $type ) ";
|
||||
$type = 'text';
|
||||
}
|
||||
$plugin_break = false;
|
||||
|
||||
if ($notifplugin) {
|
||||
if ( is_plugin_active( $notifplugin ) ) {
|
||||
$plugin_break = true;
|
||||
}
|
||||
}
|
||||
if ($ifplugin) {
|
||||
if ( !is_plugin_active( $ifplugin ) ) {
|
||||
$plugin_break = true;
|
||||
}
|
||||
}
|
||||
if ($ifclassexists) {
|
||||
if (!class_exists($ifclassexists)) {
|
||||
$plugin_break = true;
|
||||
}
|
||||
}
|
||||
if ($iffunctionexists) {
|
||||
if (!function_exists($iffunctionexists)) {
|
||||
$plugin_break = true;
|
||||
}
|
||||
}
|
||||
if ($plugin_break==false) {
|
||||
if ($type == 'bool') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'xwolf_sanitize_customizer_bool'
|
||||
) );
|
||||
$wp_customize->add_control( $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'checkbox',
|
||||
|
||||
) );
|
||||
} elseif (($type == 'toggle-switch') || ($type == 'toggle')) {
|
||||
$wp_customize->add_setting( $optionid, array(
|
||||
'default' => 0,
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'xwolf_sanitize_customizer_toggle_switch'
|
||||
)
|
||||
);
|
||||
$wp_customize->add_control( new WP_Customize_Control_Toggle_Switch( $wp_customize, $optionid, array(
|
||||
'label' => $title,
|
||||
'section' => $section,
|
||||
'description' => $label,
|
||||
)
|
||||
) );
|
||||
} elseif ($type == 'range') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'xwolf_sanitize_customizer_number'
|
||||
) );
|
||||
|
||||
$min = 0;
|
||||
$max = $step = 1;
|
||||
$suffix = '';
|
||||
|
||||
if (isset($value['min'])) {
|
||||
$min = $value['min'];
|
||||
}
|
||||
if (isset($value['max'])) {
|
||||
$max = $value['max'];
|
||||
}
|
||||
if (isset($value['step'])) {
|
||||
$step = $value['step'];
|
||||
}
|
||||
if (isset($value['suffix'])) {
|
||||
$suffix = $value['suffix'];
|
||||
}
|
||||
|
||||
$wp_customize->add_control( new WP_Customize_Range_Value_Control( $wp_customize, $optionid, array(
|
||||
'type' => 'range-value',
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'input_attrs' => array(
|
||||
'min' => $min,
|
||||
'max' => $max,
|
||||
'step' => $step,
|
||||
'suffix' => $suffix, //optional suffix
|
||||
),
|
||||
) ) );
|
||||
} elseif ($type == 'category') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( new WP_Customize_Category_Control( $wp_customize, $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'category',
|
||||
|
||||
) ) );
|
||||
} elseif ($type == 'tag') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( new WP_Customize_Tag_Control( $wp_customize, $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'tag',
|
||||
|
||||
) ) );
|
||||
} elseif ($type == 'select') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'select',
|
||||
'choices' => array_map(function($item) { return __($item, 'pirate-rogue'); }, $value['liste'])
|
||||
|
||||
) );
|
||||
} elseif ($type == 'multiselect') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( new WP_Customize_Control_Multiple_Select( $wp_customize, $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'multiple-select',
|
||||
'choices' => array_map(function($item) { return __($item, 'pirate-rogue'); }, $value['liste'])
|
||||
|
||||
) ) );
|
||||
} elseif ($type == 'colorlist-radio') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( new WP_Customize_Colorlist_Radio( $wp_customize, $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'colorlist-radio',
|
||||
'choices' => array_map(function($item) { return __($item, 'pirate-rogue'); }, $value['liste'])
|
||||
|
||||
) ) );
|
||||
|
||||
} elseif ($type == 'html') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'textarea',
|
||||
|
||||
) );
|
||||
} elseif ($type == 'image') {
|
||||
|
||||
$width = 0;
|
||||
$flexwidth = false;
|
||||
$height = 0;
|
||||
$flexheight = false;
|
||||
|
||||
if (isset($value['width'])) {
|
||||
$width = $value['width'];
|
||||
}
|
||||
if (isset($value['height'])) {
|
||||
$height = $value['height'];
|
||||
}
|
||||
if (isset($value['maxwidth'])) {
|
||||
$width = $value['maxwidth'];
|
||||
$flexwidth = true;
|
||||
}
|
||||
if (isset($value['maxheight'])) {
|
||||
$height = $value['maxheight'];
|
||||
$flexheight = true;
|
||||
}
|
||||
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
|
||||
|
||||
$wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, $optionid, array(
|
||||
'section' => $section,
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'flex_width' => $flexwidth,
|
||||
'flex_height' => $flexheight,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
) ) );
|
||||
|
||||
} elseif ($type == 'number') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'xwolf_sanitize_customizer_number'
|
||||
) );
|
||||
$wp_customize->add_control( $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'number',
|
||||
|
||||
) );
|
||||
} elseif ($type == 'text') {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
'sanitize_callback' => 'sanitize_text_field'
|
||||
) );
|
||||
$wp_customize->add_control( $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => 'text',
|
||||
|
||||
) );
|
||||
|
||||
|
||||
} else {
|
||||
$wp_customize->add_setting( $optionid , array(
|
||||
'default' => $default,
|
||||
'transport' => 'refresh',
|
||||
) );
|
||||
$wp_customize->add_control( $optionid, array(
|
||||
'label' => $title,
|
||||
'description' => $label,
|
||||
'section' => $section,
|
||||
'settings' => $optionid,
|
||||
'type' => $type,
|
||||
) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Multiple select customize control class.
|
||||
/*--------------------------------------------------------------------*/
|
||||
if (class_exists('WP_Customize_Control')) {
|
||||
class WP_Customize_Control_Multiple_Select extends WP_Customize_Control {
|
||||
// The type of customize control being rendered.
|
||||
public $type = 'multiple-select';
|
||||
|
||||
//Displays the multiple select on the customize screen.
|
||||
public function render_content() {
|
||||
if ( empty( $this->choices ) )
|
||||
return;
|
||||
?>
|
||||
<label>
|
||||
<?php if ( ! empty( $this->label ) ) : ?>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php endif;
|
||||
if ( ! empty( $this->description ) ) : ?>
|
||||
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||
<?php endif; ?>
|
||||
<select <?php $this->link(); ?> multiple="multiple" style="height: 100%;">
|
||||
<?php
|
||||
foreach ( $this->choices as $value => $label ) {
|
||||
$selected = ( in_array( $value, $this->value() ) ) ? selected( 1, 1, false ) : '';
|
||||
echo '<option value="' . esc_attr( $value ) . '"' . $selected . '>' . $label . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
<?php }
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Toogle switch
|
||||
* adapted from https://github.com/maddisondesigns/customizer-custom-controls
|
||||
/*--------------------------------------------------------------------*/
|
||||
if (class_exists('WP_Customize_Control')) {
|
||||
class WP_Customize_Control_Toggle_Switch extends WP_Customize_Control {
|
||||
// The type of control being rendered
|
||||
public $type = 'toogle-switch';
|
||||
|
||||
|
||||
public function render_content(){
|
||||
?>
|
||||
<div class="toggle-switch-control">
|
||||
<div class="toggle-switch">
|
||||
<input type="checkbox" id="<?php echo esc_attr($this->id); ?>" name="<?php echo esc_attr($this->id); ?>" class="toggle-switch-checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?>>
|
||||
<label class="toggle-switch-label" for="<?php echo esc_attr( $this->id ); ?>">
|
||||
<span class="toggle-switch-inner"></span>
|
||||
<span class="toggle-switch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php if( !empty( $this->description ) ) { ?>
|
||||
<span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Add Custom Customizer Controls - Category Dropdown
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if (class_exists('WP_Customize_Control')) {
|
||||
class WP_Customize_Colorlist_Radio extends WP_Customize_Control {
|
||||
// The type of customize control being rendered.
|
||||
public $type = 'colorlist-radio';
|
||||
|
||||
// Displays the multiple select on the customize screen.
|
||||
public function render_content() {
|
||||
if ( empty( $this->choices ) )
|
||||
return;
|
||||
?>
|
||||
<?php if ( ! empty( $this->label ) ) : ?>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php endif;
|
||||
if ( ! empty( $this->description ) ) : ?>
|
||||
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||
<?php endif; ?>
|
||||
<div class="colorlist-radio-group">
|
||||
|
||||
|
||||
|
||||
<?php foreach ( $this->choices as $name => $value ) : ?>
|
||||
<label for="_customize-colorlist-radio_<?php echo esc_attr( $this->id ); ?>_<?php echo esc_attr( $name ); ?>" <?php if ($value=="#000") { echo 'style="color: white;"'; } ?>>
|
||||
<input name="_customize-colorlist-radio_<?php echo esc_attr( $this->id ); ?>" id="_customize-colorlist-radio_<?php echo esc_attr( $this->id ); ?>_<?php echo esc_attr( $name ); ?>" type="radio" value="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $name ); ?> >
|
||||
<span class="colorbox" style="background-color: <?php echo esc_attr( $value ); ?>"> </span>
|
||||
</input>
|
||||
<span class="screen-reader-text"><?php echo ucfirst(esc_attr( $name) ); ?></span>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<label for="_customize-colorlist-radio_<?php echo esc_attr( $this->id ); ?>_reset">
|
||||
<input name="_customize-colorlist-radio_<?php echo esc_attr( $this->id ); ?>" id="_customize-colorlist-radio_<?php echo esc_attr( $this->id ); ?>_reset" type="radio" value="" <?php $this->link(); checked( $this->value(), "" ); ?> >
|
||||
<span class="reset"><?php echo __("Reset",'pirate-rogue'); ?></span>
|
||||
</input>
|
||||
</label>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Add Custom Customizer Controls - Category Dropdown
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if (class_exists('WP_Customize_Control')) {
|
||||
class WP_Customize_Category_Control extends WP_Customize_Control {
|
||||
|
||||
public function render_content() {
|
||||
?>
|
||||
|
||||
<label>
|
||||
<?php if ( ! empty( $this->label ) ) : ?>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php endif;
|
||||
if ( ! empty( $this->description ) ) : ?>
|
||||
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||
<?php endif;
|
||||
|
||||
|
||||
$dropdown = wp_dropdown_categories(
|
||||
array(
|
||||
'name' => '_customize-dropdown-categories-' . $this->id,
|
||||
'echo' => 0,
|
||||
'show_option_none' => __( '— Select —' ),
|
||||
'option_none_value' => '',
|
||||
'selected' => $this->value(),
|
||||
)
|
||||
);
|
||||
|
||||
// Hackily add in the data link parameter.
|
||||
$dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown );
|
||||
echo $dropdown;
|
||||
|
||||
?>
|
||||
</label>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Add Custom Customizer Controls - Range Value Control
|
||||
* adapted from https://github.com/soderlind/class-customizer-range-value-control
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if (class_exists('WP_Customize_Control')) {
|
||||
class WP_Customize_Range_Value_Control extends WP_Customize_Control {
|
||||
public $type = 'range-value';
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_script( 'xwolf-customizer', get_template_directory_uri() . '/js/xwolf-customizer.js', array( 'jquery' ), rand(), true );
|
||||
}
|
||||
public function render_content() {
|
||||
?>
|
||||
<label>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<div class="range-slider" style="width:100%; display:flex;flex-direction: row;justify-content: flex-start;">
|
||||
<span style="width:100%; flex: 1 0 0; vertical-align: middle;"><input class="range-slider__range" type="range" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->input_attrs(); $this->link(); ?>>
|
||||
<span class="range-slider__value">0</span></span>
|
||||
</div>
|
||||
<?php if ( ! empty( $this->description ) ) : ?>
|
||||
<span class="description customize-control-description"><?php echo $this->description; ?></span>
|
||||
<?php endif; ?>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Add Custom Customizer Controls - Tag Dropdown
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
if (class_exists('WP_Customize_Control')) {
|
||||
class WP_Customize_Tag_Control extends WP_Customize_Control {
|
||||
public function render_content() {
|
||||
$dropdown = wp_dropdown_categories(
|
||||
array(
|
||||
'name' => '_customize-dropdown-tags-' . $this->id,
|
||||
'echo' => 0,
|
||||
'orderby' => 'name',
|
||||
'show_option_none' => esc_html__( '— Select —'),
|
||||
'option_none_value' => '',
|
||||
'taxonomy' => 'post_tag',
|
||||
'selected' => $this->value(),
|
||||
)
|
||||
);
|
||||
|
||||
$dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown );
|
||||
|
||||
printf(
|
||||
'<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
|
||||
$this->label,
|
||||
$dropdown
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Sanitize Checkboxes.
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
function xwolf_sanitize_customizer_bool( $input ) {
|
||||
if ( 1 == $input ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function xwolf_sanitize_customizer_toggle_switch( $input ) {
|
||||
if ( true == $input ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function xwolf_sanitize_customizer_number( $number, $setting ) {
|
||||
$number = absint( $number );
|
||||
|
||||
return ( $number ? $number : $setting->default );
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* EOCustomizer
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user