0

Is there any possible way to change the loop structure of the Genesis Framework so that the loop header appears within the same div as the entry content?

I have tried messing around with the loop.php file in the genesis template and I have also tried looking up different hooks, but I can't seem to find anything that helps.

Is there anyone that has accomplished this or would have an idea?

user3757779
  • 31
  • 1
  • 6

3 Answers3

1

To customize the loop in Genesis, before you need to remove Genesis Loop:

remove_action( 'genesis_loop', 'genesis_do_loop' );

then you can add your custom loop

add_action( 'genesis_loop', 'my_custom_loop' );

Here is a basic example for 'standard-looking' loop working in Genesis:

function my_custom_loop() { 

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

    // Your Code Here

<?php endwhile; ?>

<?php endif; ?>

<?php
}
genesis();
?>

Please note that your function must end with 'genesis();' to work!

So the whole page code can be:

<?php
/*
 * Your Custom Page
 */
?>

<?php

remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'my_custom_loop');

function my_custom_loop() {

?>

<?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

        // Your Code

    <?php endwhile; ?>

<?php endif; ?>

<?php
}
genesis();
?>

Hope it helps ;)

FrancescoCarlucci
  • 1,570
  • 12
  • 13
1

Here is simple approach. You first remove the entry header stuff from the header.

e.g.

remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );

Once the header markup as well as entry title and entry info is removed from top.

You can add them back into your page in your desired position i.e. genesis_entry_content hook.

e.g.

add_action( 'genesis_entry_content', 'genesis_do_post_title' );

Hope this helps. Let me know if you face any issue.

Sorry forgot to add that you will need to add this custom code in your child theme's functions.php file if you want it to impact to whole site. And if you want this to happen on certain template, then in that template file in the child theme of Genesis.

Muhammad Asadullah
  • 3,735
  • 1
  • 22
  • 38
-1

I list all the most common Genesis hooks and filters used by me while developing a website without boring you with more contents. https://icodefy.com/common-genesis-hooks-filters/

suriish
  • 1
  • 3