Problem with pages using uua_staffer shortcode

ForumCategory: TechnicalProblem with pages using uua_staffer shortcode
cwjordan asked 4 months ago

I’m using the UUA Congregation theme version 1.1.2.  
On pages where I use the uua_staffer shortcode I noticed the menu on the left disappears, and the “breadcrumbs” on the top incorrectly say the name of the last staff member whose entry was displayed instead of the name of the page.  After some poking around I was able to fix the problem by modifying uua-congregation/lib/shortcodes/uua-staffer.php to change line 77 from:
<code><?php endwhile; ?></code>
to:
<code><?php endwhile; 
                        wp_reset_postdata(); ?></code>
Looks like the old version of uua-staffer.php did that, but it was left out of this version.  
 

Margy Levine Young Staff replied 4 months ago

I’m passing this along to the developers to see what’s up.

3 Answers
Spencer Sherman Staff answered 4 months ago

Hey @cwjordan – I’m not seeing any changes to the uua-staffer.php file, and the wp_reset_postdata(); remains in the same place (line 83). Did you delete that instance when you added it to line 77?

cwjordan replied 4 months ago

Spencer,

I’m comparing the uua-staffer.php file from version 1.0.1 of the theme with the current version in 1.1.2. The new one is about 11 lines longer, so changes were made. Version 1.1.2 has two places it could return from, lines 81 and 86 (appears line 86 could never be reached…) . It does a wp_reset_postdata() on line 83 prior to the return in line 86, but not prior to the return on line 81. I left the instance on line 83 and just added an additional one on line 77. Looks to me like nothing between line 81 to 88 could ever actually be executed, as the function returns in line 81.

Feels to me like the main change between version 1.0.1 and 1.1.2 was to wrap the function in a “function_exists”, but some lines at the end of the function were accidentally duplicated?

Margy Levine Young Staff answered 3 months ago

This has been fixed in version 1.1.3 of the theme.

Margy Levine Young Staff answered 2 months ago

CW, is this all set?

cwjordan replied 2 months ago

Yes, it was fixed in 1.1.3 as you said. Thanks!