• 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

Genesis Theme Defaults – Image Alignment

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

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Genesis Theme Defaults – Image Alignment

This topic is: resolved

Tagged: genesis theme defaults

  • This topic has 9 replies, 2 voices, and was last updated 10 years, 5 months ago by Gakuranman.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • August 23, 2015 at 12:09 pm #163240
    Gakuranman
    Member

    Hi all. I'm trying to set the theme defaults for a child theme I'm working on.

    In the defaults file, I have the following (just a few of many variables):

    'content_archive' => 'full',
    'content_archive_limit' => 100,
    'content_archive_thumbnail' => 1,
    'image_size' => 'featured',
    'image_alignment' => '',
    'posts_nav' => 'prev-next',

    The default image_alignment in Genesis always goes to 'alignLeft', but I need to have it centered or set to nothing. I've tried setting this with ' ' or '-None-' but it didn't work.

    Does anyone know what I need to specify in order that the theme sets the image_alignment to '- None -'?

    http://.
    August 23, 2015 at 1:31 pm #163243
    Marcy
    Participant

    You can use this:
    'image_alignment' => 'alignleft',

    Replace your image_alignment line above with that one.


    Marcy | Amethyst Website Design | Twitter

    August 24, 2015 at 6:02 am #163283
    Gakuranman
    Member

    Hi Marcy,

    Sorry for not being clearer. I need my image alignment to be centered or set to 'nothing'. I do not want it set to alignleft.

    Any ideas?

    August 24, 2015 at 9:16 am #163304
    Marcy
    Participant

    So then use
    'image_alignment' => 'aligncenter',
    OR
    'image_alignment' => 'alignnone',


    Marcy | Amethyst Website Design | Twitter

    August 24, 2015 at 11:41 am #163319
    Gakuranman
    Member

    Hmm. It just doesn't seem to respond to any class at all; alignright, aligncenter, alignnone. Even tried '.alignright', but the theme always defaults to alignleft...

    Can you see any coding errors below? The rest of the options are being read properly, so I don't think there are errors, but I could be overlooking something!

    If not, could you show me an example where you've seen this parameter successfully changed in a theme before? If I can test a known working file, I can determine if there is something else affecting the code.

    //* Theme Default Settings
    add_filter( 'genesis_theme_settings_defaults', 'test_theme_settings' );
    function test_theme_settings( $defaults ) {
    $defaults = array(
    'update' => 1,
    'blog_title' => 'text',
    'header_right' => 0,
    'site_layout' => 'full-width-content',
    'nav_type' => 'nav-menu',
    'nav_extras' => '',
    'nav_extras_enable' => 0,
    'subnav_type' => 'nav-menu',
    'redirect_feeds' => 0,
    'comments_pages' => 0,
    'comments_posts' => 1,
    'trackbacks_pages' => 0,
    'trackbacks_posts' => 1,
    'breadcrumb_home' => 0,
    'breadcrumb_front_page' => 0,
    'breadcrumb_posts_page' => 0,
    'breadcrumb_single' => 0,
    'breadcrumb_page' => 0,
    'breadcrumb_archive' => 0,
    'breadcrumb_404' => 0,
    'breadcrumb_attachment' => 0,
    'content_archive' => 'full',
    'content_archive_limit' => 100,
    'content_archive_thumbnail' => 1,
    'image_size' => 'featured',
    'image_alignment' => 'alignnone',
    'posts_nav' => 'prev-next',
    'blog_cat_num' => 10,
    'theme_version' => PARENT_THEME_VERSION,
    );
    return $defaults;
    }

    August 24, 2015 at 1:40 pm #163338
    Marcy
    Participant

    You do understand that the child theme settings screen will override those defaults?

    That means that if you go to Genesis > Settings, and make changes, those will override.

    Also if you have a grid loop in home.php or front-page.php, those settings will override, and that would be my first guess to look.

    Also I really can't help more without a link to your site to see what images, and where you are actually talking about.


    Marcy | Amethyst Website Design | Twitter

    August 24, 2015 at 5:29 pm #163353
    Gakuranman
    Member

    Thanks so much for your time!

    Yes, I understand how the child themes work. I'm building a new site and it's a pain to have to go back and change the settings every time I reload the theme and switch between others for. I haven't been able to find anyone implementing the image_alignment setting in their theme defaults yet, but I will continue to look.

    August 24, 2015 at 6:32 pm #163358
    Marcy
    Participant

    Do you have the Author Pro theme? That one has a /lib/theme-defaults.php.

    Besides a section like that you posted above, it has

    add_action( 'after_switch_theme', 'author_theme_setting_defaults' );
    function author_theme_setting_defaults() {
    
    	if( function_exists( 'genesis_update_settings' ) ) {
    
    		genesis_update_settings( array(
    			'blog_cat_num'              => 6,
    			'content_archive_limit'     => 0,
    			'content_archive_thumbnail' => 0,
    			'image_alignment'           => 'alignright',
    			'posts_nav'                 => 'numeric',
    			'site_layout'               => 'full-width-content',
    		) );
    // More code here
    }
    }

    The image_alignment was alignleft, but I just changed it in the theme-defaults.php file in both places to alignright, and the images are alignright.
    It applies to the blog and the blog archives, not any CPTs.

    Also once I change it in Genesis > Settings that's the way it stays unless I edit the theme-defaults.php in both places, then click the Reset Settings button in Genesis > Settings.
    So it does work. I wonder what is going wrong for you?

    Are all the other settings showing up OK?

    Oh, and there is no aligncenter choice in Genesis > Settings. I always forget that.


    Marcy | Amethyst Website Design | Twitter

    August 24, 2015 at 6:36 pm #163360
    Marcy
    Participant

    Clicking Reset Settings in Genesis > Settings allows the theme to pick up whatever I have in /lib/theme-defaults.php
    Try it to see if that will do it for you.


    Marcy | Amethyst Website Design | Twitter

    August 25, 2015 at 8:18 am #163424
    Gakuranman
    Member

    Thanks for the follow up!

    I found something incredibly odd. When I set Image_alignment to ' ' in the theme genesis_theme_settings_defaults, it does not register and sets the image to 'alignleft' instead. It results to this every time I click the 'reset settings' button.

    However, when I use the code you provided utilising after_switch_theme as below, it sets my image alignment to ' ' after switching themes. This solves my problem and allows me to switch between themes without having to go back and setup the image alignment! Although frankly, I have no idea why setting image_alignment under the defaults does not work. A bug perhaps?

    In any case, thanks for sticking with me. We got there!

    //* Theme Default Settings
    add_action( 'after_switch_theme', 'test_theme_setting_defaults' );
    function test_theme_setting_defaults() {

    if( function_exists( 'genesis_update_settings' ) ) {

    genesis_update_settings( array(
    'content_archive_thumbnail' => 1,
    'image_alignment' => '',
    ) );
    }
    }

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Genesis Theme Defaults – Image Alignment’ is closed to new replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 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