• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

te1

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password
  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • November 2, 2015 at 10:29 am in reply to: Reposition the entry header #169879
    te1
    Member

    Hi all,

    I'm bumping this post as what I tried didn't work.

    Any help is much appreciated.

    September 4, 2015 at 4:21 am in reply to: Reposition the entry header #164543
    te1
    Member

    Hi pxforti,

    I tried your approach but it didn't work.

    Here is my code:

    function move_post_title() {
    	if ( !is_single() )
    		return;
    	//* Reposition the entry header
    	remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
    	remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
    	remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    	add_action( 'genesis_before_content', 'custom_genesis_entry_header_markup_open', 5 );
    	function custom_genesis_entry_header_markup_open() {
    		$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
    		$video = get_field('featured_video');
    
    		if($video)
    		{
    			printf( '<header %s><video src="' . $video . '" poster="' . $image[0] . '" width="" height="" controls preload></video>', genesis_attr( 'entry-header' ) );
    		} else if(!empty($image)) {
    			printf( '<header %s style="background-image:url(' . $image[0] . ');">', genesis_attr( 'entry-header' ) );
    		} else {
    			printf( '<header %s style="background-image:url(' . get_stylesheet_directory_uri() . '/images/fire-risk-assessment-bg.jpg);">', genesis_attr( 'entry-header' ) );
    		}
    	}
    	add_action( 'genesis_before_content', 'genesis_entry_header_markup_close', 15 );
    	add_action( 'genesis_before_content', 'genesis_do_post_title' );
    }

    Please can you help me with this as I am still learning.

    Thank you.

    April 24, 2015 at 9:42 am in reply to: How do I add a class to the genesis attribute entry? #149032
    te1
    Member

    @Badlywired I figured it out! Thanks for your pointers towards this.

    Here is the working code:

    add_filter( 'genesis_attr_entry', 'custom_attributes_entry' );
    function custom_attributes_entry( $attributes ) {
    	global $post;
    
    	$terms = wp_get_post_terms( $post->ID, 'sa_tax_sources', array('fields' => 'slugs') );
    	$typename = implode(' ', $terms);
    
    	$attributes['class'] .= ' '. $typename;
    	return $attributes;
    }
    April 24, 2015 at 4:06 am in reply to: How do I add a class to the genesis attribute entry? #149004
    te1
    Member

    @Badlywired Ok, I understand. Yes, thank you for your pointers, they're a great help.

    April 24, 2015 at 3:47 am in reply to: How do I add a class to the genesis attribute entry? #149002
    te1
    Member

    @Badlywired I now get this error: PHP Catchable fatal error: Object of class stdClass could not be converted to string in /wp-content/themes/genesis-sample/functions.php on line 219

    April 24, 2015 at 3:38 am in reply to: How do I add a class to the genesis attribute entry? #149000
    te1
    Member

    @Badlywired I tried using your version but I get this error? PHP Parse error: syntax error, unexpected ',' in /wp-content/themes/genesis-sample/functions.php on line 222

    April 24, 2015 at 3:29 am in reply to: How do I add a class to the genesis attribute entry? #148999
    te1
    Member

    @Badlywired Right, I'll give that a go...

    April 24, 2015 at 3:14 am in reply to: How do I add a class to the genesis attribute entry? #148996
    te1
    Member

    @Badlywired I tried your code first but it didn't work? It didn't break anything but nothing showed up...

    "I assume you want the taxonomy term used on that specific post, not all of them?" - Yes, this is what I'm trying to achieve.

    I appreciate your help.

    April 24, 2015 at 3:11 am in reply to: How do I add a class to the genesis attribute entry? #148995
    te1
    Member

    Maybe something like this?

    add_filter( 'genesis_attr_entry', 'custom_attributes_entry' );
    function custom_attributes_entry( $attributes ) {
    	$attributes['class'] .= ' ', array( 'class' => $typename);
    	return $attributes;
    }
    April 24, 2015 at 2:56 am in reply to: How do I add a class to the genesis attribute entry? #148990
    te1
    Member

    @Ren Ventura Yes that worked as I've managed to add a class of 'test' to the article entry, but how do I add a class using the variable $typename?

    $terms = get_terms( 'sa_tax_sources' );
    $typename = $terms[0]->name;

    Any help is much appreciated.

    April 22, 2015 at 3:58 am in reply to: Add a class to the genesis attribute entry #148776
    te1
    Member

    Hi there,

    Ok, I'll try and do that for next time. Do you have any suggestions on this?

    Here is a bit more of an in-depth explanation:

    I'm trying to achieve adding a class to the article depending on which post/social feed it is using the get_terms taxonomy. My test post is being displayed (the first/latest one) but it doesn't have the class of Twitter, for example, in the case of this argument. I've tried adding the variable $typename as a class/attribute to the article but it's not working.

    November 13, 2014 at 6:58 am in reply to: How do I make the entry title full width? #131404
    te1
    Member

    I managed to achieve this with this code:

    add_action( 'genesis_after_header', 'relocate_entry_title_singular' );
    function relocate_entry_title_singular() {

    if ( ! is_singular() )
    return;
    echo '<div class="entry-header"><div class="wrap">';
    genesis_do_post_title();
    echo '</div></div>';

    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );

    }

    November 13, 2014 at 5:51 am in reply to: How do I make the entry title full width? #131399
    te1
    Member

    Hi,

    Thank you for the response.

    This would work but I have added a structural wrap to the site inner.

    Do you have another suggestion?

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble