• 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

Php help please

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 › Php help please

This topic is: resolved

Tagged: is_page, php

  • This topic has 1 reply, 1 voice, and was last updated 6 years ago by jbculp.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 12, 2017 at 11:33 am #206338
    jbculp
    Participant

    OK, I'm stuck. I hate to slam a bunch of code here but I can't figure this out. I support a WordPress site on a custom Genesis theme I didn't create. In short, the creators of this theme seemed to dice it all up into sections of code. The main content area of a given page is divided into two columns. Now the client wants to put in a full width set of content. Their intention is to put an iFrame into the area to span the whole width. Without customization, the iFrame slams into a small column on the left (the result of the split mentioned above). What I can't figure out is how to deactivate the split on that one page. In my test version I got the iFrame in before the content section (hard coded in the PHP for testing) but behind it is the dotted line separating the columns and a huge amount of dead space under the iFrame.

    Here is the original code that leads up to the columns:

    * ! Loop Customizations */
    
    add_action('genesis_before_loop', 'dmeyers_pre_loop');
    
    function dmeyers_pre_loop() {
    	if (is_page()) {
    		// overide the Genesis loop
    		remove_action('genesis_loop', 'genesis_do_loop');
    		add_action('genesis_loop', 'dmeyers_page_loop');
    	} else {
    		// open columns markup
    		dmeyers_open_columns();
    		
    		
    		// add post hook for conditional customizations
    		add_action('genesis_before_post', 'dmeyers_before_post');
    		add_action('genesis_after_post', 'dmeyers_post_reset');
    		
    		
    		// close the columns after the loop
    		add_action('genesis_after_loop', 'dmeyers_close_columns');
    	}
    }
    
    /* ! Columns Markup */
    
    function dmeyers_open_columns() {
    ?>
    	<div class="columns">
    		<div class="column-blurb">
    		</div> <!-- end .blurb -->
    		<div class="column-featured">
    <?php
    }
    
    function dmeyers_close_columns() {
    ?>
    		</div> <!-- end .column-featured -->
    	</div> <!-- end .columns -->
    <?php
    }
    

    And here is my version. You see I'm calling the new page template and the iFrame first but further down I've tried to deactivate the columns section on page ID 1028 but it doesn't work. I have the 1028 ID in two places. What I really want is this:
    If page template = x do this, otherwise do your normal loop as defined by this custom theme.
    My Code that only 1/2 works:

    * ! Loop Customizations */
    
    add_action('genesis_before_loop', 'dmeyers_pre_loop');
    
    function dmeyers_pre_loop() {
    
      if (is_page_template( 'jbagley.php' )) {
    
        echo '<div class="jbagley"><iframe src="http://johnbagleyusa.com/retailer/?jbid=g475u2t5d8c4b1j5y8r7spe34nm5b7y29" style="width:100%;height:900px;border:none"></iframe><br /></div>';
    
        remove_action('genesis_loop', 'genesis_do_loop');
        add_action('genesis_loop', 'dmeyers_page_loop');
      }
    
      elseif (is_page () && !is_page(1028)) {
    		// overide the Genesis loop
    		remove_action('genesis_loop', 'genesis_do_loop');
    		add_action('genesis_loop', 'dmeyers_page_loop');
    	} else {
    		// open columns markup
    		(is_page () && !is_page(1028));
    		dmeyers_open_columns();
    		
    		
    		// add post hook for conditional customizations
    		add_action('genesis_before_post', 'dmeyers_before_post');
    		add_action('genesis_after_post', 'dmeyers_post_reset');
    		
    		
    		// close the columns after the loop
    		add_action('genesis_after_loop', 'dmeyers_close_columns');
    	}
    }
    
    /* ! Columns Markup */
    
    function dmeyers_open_columns() {
    ?>
    	<div class="columns">
    		<div class="column-blurb">
    		</div> <!-- end .blurb -->
    		<div class="column-featured">
    <?php
    }
    
    function dmeyers_close_columns() {
    ?>
    		</div> <!-- end .column-featured -->
    	</div> <!-- end .columns -->
    <?php
    }
    

    Again, I'm sorry to include all this code. I hope someone can fish thru this and help.
    jc

    http://dmeyersjeweler.com/john-bagley/
    May 12, 2017 at 4:48 pm #206360
    jbculp
    Participant

    I'm rethinking my lack of understanding about some aspects of the Php in this request so am withdrawing my support request.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

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