Community Forums › Forums › Archived Forums › Design Tips and Tricks › "Call to undefined function genesis_before_post()" errormessage
Tagged: genesis_custom_loop, genesis_loop
- This topic has 15 replies, 3 voices, and was last updated 5 years, 5 months ago by Brad Dalton.
-
AuthorPosts
-
July 24, 2019 at 1:48 am #492527michaeloeserMember
Hi guys,
on a client site I suddenly get an error when opening a category archive:
"Call to undefined function genesis_before_post()"
I assume this happens since the last Genesis update but I´m not sure since it was just discovered today.
I´m using a custom child theme which used to work without any issues since a long time. I assume I just need to change the function to some newer function, right?
Any suggstions?
UPDATE: in fact I was able to get rid of the main symptoms by commenting out the functions that are „undefined“. Seems like they are older functions that are not used in the latest Genesis version anymore.
Is there a „old vs. new“ function reference available?
July 24, 2019 at 1:50 am #492528Brad DaltonParticipantJuly 24, 2019 at 1:55 am #492529michaeloeserMemberIt´s some old function(s) obviously
genesis_before_post()
genesis_before_post_title()
genesis_before_post_content()
genesis_after_post_content()
genesis_after_post()
genesis_after_endwhile()
genesis_loop_else()I assume there must be some newer function to replace them.
July 24, 2019 at 1:59 am #492530Brad DaltonParticipantJuly 24, 2019 at 2:10 am #492531michaeloeserMemberI get "Call to undefined function genesis_before_entry()"
See: https://www.car-it.com/category/news
Do I have to change any else setting?
July 24, 2019 at 2:11 am #492532Brad DaltonParticipantJuly 24, 2019 at 2:36 am #492533michaeloeserMemberOk this is the whole code of the category.php file.
Error see: https://www.car-it.com/category/news<?php /** * Category Template - generic */ /** * Prevent direct access to this file. * * @since 1.0.0 */ if ( ! defined( 'WPINC' ) ) { exit( 'Sorry, you are not allowed to access this file directly.' ); } remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'dp_amtv_category_generic_loop_helper' ); /** * Add custom loop helper for "Big Data" category. */ function dp_amtv_category_generic_loop_helper() { ?> <?php $i=1; if (have_posts()) : while (have_posts()) : the_post(); // the loop ?> <?php genesis_before_entry(); /////genesis_before_post(); ?> <div <?php post_class(); ?>> <?php /////genesis_before_post_title(); ?> <h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php /////genesis_after_post_title(); ?> <?php /////genesis_before_post_content(); ?> <div class="entry-content"> <?php if(genesis_get_option('content_archive') == 'full') : the_content(__('[Read more...]', 'genesis')); else : if(genesis_get_option('thumbnail')) genesis_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array('class' => 'alignleft post-image'))); the_excerpt(); endif; ?> </div><!-- end .entry-content --> <?php /////genesis_after_post_content(); ?> <?php if($i == 2 ) : ?> <!-- Banner 1 --> <?php // Include the content ad format 1st position on archives if ( !is_category ( array ('t-systems-subnet','plm','siemens-subnet') ) ) { include(CHILD_DIR.'/inc/category-ad.php'); } ?> <?php elseif ($i == 4 ) : ?> <!-- Banner 2 --> <?php // Include the content ad format 2nd position on archives if ( !is_category ( array ('t-systems-subnet','plm') ) ) { include(CHILD_DIR.'/inc/category-ad2.php'); } ?> <?php elseif ($i == 6 ) : ?> <!-- Banner 3 --> <?php // Include the content ad format 3rd position on archives if ( !is_category ( array ('t-systems-subnet','plm') ) ) { include(CHILD_DIR.'/inc/category-ad3.php'); } ?> <?php /* elseif ($i == 8 ) : ?> <!-- Banner 4 --> <?php // Include the content ad format 4th position on archives if ( !is_category ( array ('t-systems-subnet','plm') ) ) { include(CHILD_DIR.'/inc/content-ad4.php'); } */?> <?php endif; ?><!-- end if Abfrage für Banner --> </div><!-- end .postclass --> <?php /////genesis_after_post(); ?> <?php $i++; endwhile; // end of one post ?> <?php /////genesis_after_endwhile(); ?> <?php else : // if no posts exist ?> <?php /////genesis_loop_else(); ?> <p><?php _e('Sorry, no posts matched your criteria.', 'genesis'); ?></p> <?php endif; // end loop ?> <?php } // end function /** * Let Genesis take over again */ genesis();
July 24, 2019 at 2:43 am #492534Brad DaltonParticipantYou should be able to swap out the old hooks with the new ones.
What theme are you using?
July 25, 2019 at 11:51 pm #492583michaeloeserMemberEven if I swap e.g. genesis_before_post() with genesis_before_entry(), I get "Call to undefined function genesis_before_entry()".
See: https://www.car-it.com/category/news
I don´t know exactly which old function to swap with which new one. That´s why I asked for a sort of table that says something like "this is the old function A and this is the new function A" etc.
I´m using a custom child theme.
July 25, 2019 at 11:58 pm #492584Brad DaltonParticipantWhere did you get the code from?
Try do_action( 'genesis_before_entry' );
July 31, 2019 at 4:58 am #492685Victor FontModeratorYou're not calling genesis_before_entry correctly. genesis_before_entry is an action hook, it is not a function so the error you are receiving is correct.
The correct way of calling genesis_before_entry is:
do_action( 'genesis_before_entry' );
Look through genesis/lib/structure/loops.php for the correct way to call the action hooks you're calling as functions.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?July 31, 2019 at 5:21 am #492686Brad DaltonParticipant@michaeloeser Also, another way to create a custom loop is to use genesis_custom_loop
August 1, 2019 at 1:45 am #492705michaeloeserMemberThank you guys for your help.
My issue is I´m much more of a designer than a coding guy but I will see what I can do.
August 1, 2019 at 2:03 am #492707michaeloeserMemberIs there anyone who can assist with the custom loop. Doesn´t have to be for free.
August 1, 2019 at 2:17 am #492708Brad DaltonParticipantPlease contact me here and let me know exactly what you need [email protected]
August 2, 2019 at 5:26 am #492741Brad DaltonParticipant -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.