Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add featured image on single post
- add_action( 'genesis_entry_header', 'themeprefix_featured_image', 1 );
- function themeprefix_featured_image() {
- $image = genesis_get_image( array( // more options here -> genesis/lib/functions/image.php
- 'format' => 'html',
- 'size' => 'large',// add in your image size large, medium or thumbnail - for custom see the post
- 'context' => '',
- 'attr' => array ( 'class' => 'aligncenter' ), // set a default WP image class
- ) );
- if ( is_singular()) {
- if ( $image ) {
- printf( '<div class="featured-image-class">%s</div>', $image ); // wraps the featured image in a div with css class you can control
- }
- }
- }
- // add class to body
- add_filter( 'body_class', 'add_body_class' );
- function add_body_class( $classes ) {
- $classes[] = 'custom-home-template';
- return $classes;
- }
- // remove entry title
- //remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
- //add html wrap page featured image and to display featured image
- add_action( 'genesis_entry_header', 'rtug_entry_header_first', 9 );
- function rtug_entry_header_first() {
- echo '<div class="singular-featured-image">';
- genesis_image( array( 'size' => 'singular-featured-thumb' ) );
- echo '</div><div class="post-info-wrap">';
- }
- // entry header title modify
- add_filter( 'genesis_post_title_output', 'bn_post_title_output', 15 );
- function bn_post_title_output( $title ) {
- if ( is_singular() ) {
- $title = sprintf( '<h1 class="entry-title">%s <br><span>Your Step-by-Step Guide To Getting Your First Blog Up and Running in No Time!</span></h1>', apply_filters( 'genesis_post_title_text', get_the_title() ) );
- return $title;
- }
- }
- //add html content after header title tag
- add_action( 'genesis_entry_header', 'rtug_before_entry_content' );
- function rtug_before_entry_content() {
- echo '<span class="entry-lead">Guide by Karen Evans. Last updated: July 19th, 2018.</span></div>';
- }
- //add html wrap author_box
- add_action( 'genesis_before_entry_content', 'rtug_author_box' );
- function rtug_author_box() {
- if ( is_page() )
- echo '<div class="main-author-box">';
- genesis_author_box( 'page', true );
- echo '</div>';
- }
- //gravatar_size
- add_filter( 'genesis_author_box_gravatar_size', 'rtug_author_box_gravatar_size' );
- function rtug_author_box_gravatar_size() {
- return 216;
- }
- //remove author_box title
- add_filter( 'genesis_author_box_title', 'custom_author_box_title' );
- function custom_author_box_title() {
- return '';
- }
- //add html wrap author_box image and description
- add_filter( 'genesis_author_box', 'jivedig_remove_avatar_author_box', 10, 6 );
- function jivedig_remove_avatar_author_box( $output, $context, $pattern, $gravatar, $title, $description ) {
- echo '<div class="author-image">';
- echo $gravatar ;
- echo '</div>';
- echo '<div class="author-bio">';
- echo $description ;
- echo '</div>';
- }
- //Remove Avatar from Genesis Author Box
- add_filter( 'genesis_author_box', 'jivedig_remove_avatar_author_box', 10, 6 );
- function jivedig_remove_avatar_author_box( $output, $context, $pattern, $gravatar, $title, $description ) {
- return sprintf( $pattern, '', $title, $description );
- }
- // Remove 'site-inner' from structural wrap
- add_theme_support( 'genesis-structural-wraps', array( 'header', 'footer-widgets', 'footer' ) );
- //* Modify Leave a reply title text in comments
- add_filter( 'comment_form_defaults', 'topleague_comment_form_defaults' );
- function topleague_comment_form_defaults( $defaults ) {
- $defaults['title_reply'] = __( 'Question and Answers' );
- return $defaults;
- }
- //* Modify comments title text in comments
- add_filter( 'genesis_title_comments', 'topleague_genesis_title_comments' );
- function topleague_genesis_title_comments() {
- $title = '<h3>Question and Answers</h3>';
- return $title;
- }
- //* Customize the submit button text in comments
- add_filter( 'comment_form_defaults', 'topleague_comment_submit_button' );
- function topleague_comment_submit_button( $defaults ) {
- $defaults['label_submit'] = __( 'Submit');
- return $defaults;
- }
- //add your checkbox after the comment field
- add_filter( 'comment_form_field_comment', 'my_comment_form_field_comment' );
- function my_comment_form_field_comment( $comment_field ) {
- return $comment_field.'<p class="pprivacy"><input type="checkbox" name="privacy" value="privacy-key" class="privacyBox" aria-req="true">
- <label>I accept the <a target="blank" href="privacy-policy/">Privacy Policy</a></label><p>';
- }
- //javascript validation
- add_action('wp_footer','valdate_privacy_comment_javascript');
- function valdate_privacy_comment_javascript(){
- if (comments_open()){
- wp_enqueue_script('jquery');
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function($){
- $("#submit").click(function(e){
- if (!$('.privacyBox').prop('checked')){
- e.preventDefault();
- alert('You must agree to our privacy term by checking the box ....');
- return false;
- }
- })
- });
- </script>
- <?php
- }
- }
- // Register a custom image size for Singular Featured images
- add_image_size( 'singular-featured-thumb', 840, 500, true );
- // add html before comment form
- add_action( 'genesis_before_comments', 'rtug_genesis_before_comments' );
- function rtug_genesis_before_comments() {
- echo '
- <img src="'.get_stylesheet_directory_uri().'/images/arrow-down.png" class="aligncenter arrow-comments lazyloading" data-was-processed="true">
- <a href="#" id="comments-expander-trigger">
- <span class="comments-expander-text">';
- comments_number( 'no Comments', 'one Comment', '% Comments' );
- echo '</span>
- <span class="comments-expander-arrow" style="font-family: sans-serif;">»</span>
- </a>
- <div id="comments-expander">
- ';
- }
- add_action( 'genesis_after_comment_form', 'rtug_genesis_after_comments' );
- function rtug_genesis_after_comments() {
- echo '</div>';
- }
- // add html before footer
- add_action( 'genesis_before_footer', 'rtug_genesis_before_footer' );
- function rtug_genesis_before_footer() {
- echo '<section class="sites-count">
- <div class="holder">
- <div class="data">
- <i class="fa fa-laptop"></i> <span>';
- $total = wp_count_posts()->publish;
- echo $total;
- echo ' blogs created with this guide... and counting!</span>
- </div>
- </div>
- </section>
- ';
- }
- //Remove Existing Footer
- remove_action( 'genesis_footer', 'genesis_do_footer' );
- /**
- * Add Footer Widget to Genesis
- *
- * @link http://wpbeaches.com/create-footer-widget-area-genesis-child-theme/
- */
- add_action( 'widgets_init', 'yourtheme_extra_widgets' );
- // Add in new Widget area
- function yourtheme_extra_widgets() {
- genesis_register_sidebar( array(
- 'id' => 'footercontent',
- 'name' => __( 'Footer', 'yourtheme' ),
- 'description' => __( 'This is the general footer area', 'yourtheme' ),
- 'before_widget' => '<div class="footercontent">',
- 'after_widget' => '</div>',
- ));
- }
- add_action('genesis_footer','yourtheme_footer_widget');
- // Position the Footer Area
- function yourtheme_footer_widget() {
- genesis_widget_area ('footercontent', array(
- 'before' => '<div class ="footercontainer">',
- 'after' => '</div>',
- ));
- }
- // footer menu function
- function wdm_add_footer_menu()
- {
- wp_nav_menu(array(
- 'container_id' => 'footer' ,
- 'menu_class' => 'menu-footer-menu',
- 'theme_location' => 'secondary',
- 'depth' => 1,
- 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>'
- ) );
- }
- //remove footer menu
- remove_action( 'genesis_footer', 'genesis_do_subnav' );
- // remove footer copyright text
- function wpb_footer_creds_text () {
- $copyright = '';
- return $copyright;
- }
- add_filter( 'genesis_footer_creds_text', 'wpb_footer_creds_text' );
- // add content after footer area
- add_action( 'genesis_after_footer', 'rtug_genesis_after_footer' );
- function rtug_genesis_after_footer() {
- echo '<section class="real_footer">
- <div class="wrap">
- <div class="three-sixths first credits">
- <p>© 2018 · StartBloggingOnline · All Rights Reserved';
- echo '.</p> </div> <div class="three-sixths fmenu">';
- wdm_add_footer_menu();
- echo '</div>
- </div>
- </section>';
- }
- //Modify Entire Footer Text (including markup)? please check this box genesis simple edit
- <div class="footer-copyright-wrap fix">
- <div class="wrap">
- [copyright_leftarea][copyright_middlearea][copyright_righttarea]
- </div>
- </div>
- // Moving Post Categories from Entry Meta to above Post Title in Genesis.
- ---------------------------------------
- //* Add Post categories above Post title on single Posts
- add_action ( 'genesis_entry_header', 'sk_show_category_name', 9 );
- function sk_show_category_name() {
- if ( ! is_singular('post') )
- return;
- echo do_shortcode('[post_categories before="Filed Under: "]');
- }
- //* Show only Post tags in entry meta for single Posts
- add_filter( 'genesis_post_meta', 'sk_post_meta_filter' );
- function sk_post_meta_filter($post_meta) {
- if ( is_singular('post') ) :
- $post_meta = '[post_tags]';
- else :
- endif;
- return $post_meta;
- }
- // Moving Post Info above Post Title in Genesis.
- -------------------------------------------
- //* Position post info above post title
- remove_action( 'genesis_entry_header', 'genesis_post_info', 12);
- add_action( 'genesis_entry_header', 'genesis_post_info', 9 );
- // add content between the Post title and the author and date info.
- ----------------------------
- add_action( 'genesis_entry_header', 'rtug_entry_header' );
- function rtug_entry_header() {
- echo '<p>A piece of extra content between the title and byline</p>';
- }
- -- or --
- add_action( 'genesis_post_title', 'rtug_entry_header' );
- function rtug_entry_header() {
- echo '<p>A piece of extra content between the title and byline</p>';
- }
- // add content directly above the Post or Page title.
- ----------------------------
- add_action( 'genesis_entry_header', 'rtug_entry_header_first', 9 );
- function rtug_entry_header_first() {
- echo '<p>A piece of extra content directly above the title</p>';
- }
- -- or --
- add_action( 'genesis_post_title', 'rtug_entry_header_first', 9 );
- function rtug_entry_header_first() {
- echo '<p>A piece of extra content directly above the title</p>';
- }
- // wrap entry titles inside a custom div in Genesis
- ---------------------------
- // Add custom opening div for post title
- add_action( 'genesis_entry_header', 'sk_do_post_title_before', 7 );
- function sk_do_post_title_before() {
- echo '<div class="my-entry-title">';
- }
- // Add custom closing div for post title
- ------------------------------
- add_action( 'genesis_entry_header', 'sk_do_post_title_after' );
- function sk_do_post_title_after() {
- echo '</div>';
- }
- // add html after widget title
- ----------------------------------
- add_filter( 'dynamic_sidebar_params', 'b3m_wrap_widget_titles', 20 );
- function b3m_wrap_widget_titles( array $params ) {
- // $params will ordinarily be an array of 2 elements, we're only interested in the first element
- $widget =& $params[0];
- $widget['before_title'] = '<h4 class="widgettitle home_widget_title">';
- $widget['after_title'] = '</h4><div class="paloma-accent accent-small home_widgt">
- <svg xmlns="http://www.w3.org/2000/svg" width="41.4" height="9.5" viewBox="0 0 41.4 9.5">
- <path d="M40.7 8.1L34 1.4l-6.6 6.7-6.7-6.7L14 8.1 7.4 1.4.7 8.1" class="st0"></path>
- </svg>
- </div>';
- return $params;
- }
- //Display Your Genesis Blog in Grid Layout
- //* Grid Style Content Archive
- function be_archive_post_class( $classes ) {
- // Don't run on single posts or pages
- if( !is_home() )
- return $classes;
- $classes[] = 'one-third';
- global $wp_query;
- if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 )
- $classes[] = 'first';
- return $classes;
- }
- add_filter( 'post_class', 'be_archive_post_class' );
- function he_archive_post_class( $classes ) {
- // Don't run on single posts or pages
- if( !is_category() )
- return $classes;
- $classes[] = 'one-third';
- global $wp_query;
- if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 )
- $classes[] = 'first';
- return $classes;
- }
- add_filter( 'post_class', 'he_archive_post_class' );
Advertisement
Add Comment
Please, Sign In to add comment