KACramer
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Photo Album Plus] Modifying wppa-breadcrumbs.php to render page content?Sorry… yeah… I fiqured it out last night. The h1 in the theme’s css was tied to the content div… so anyway, added css for new div id called “photoAlbum_pageTitle” and used it instead of h1… So I am good now. Thanks!
Forum: Plugins
In reply to: [WP Photo Album Plus] Modifying wppa-breadcrumbs.php to render page content?Okay I sort of figured it out… I did this:
$photopage = "/photo-albums/"; $currentpage = $_SERVER['REQUEST_URI']; if($photopage==$currentpage) { $wppa_pagetitle=get_the_title(); $wppa_PageContentText=get_the_content(); } $wppa['out'] .= wppa_nltab('-').'</div><h1>'.$wppa_pagetitle.'</h1><p>'.$wppa_PageContentText.'</p>'; }
But it’s not formating the title with the h1 information from my css… Any idea why?
It looks great. Did you create a template override?
Yes. Thanks!
Thanks for the replies… I figured it out ??
When I made that change, it stopped working again… the way it did before I made my earlier change. Maybe if you used get_excerpt_by_post function instead of get_the_excerpt?
I will need to edit:
function rpwe_excerpt( $length ) { $content = get_excerpt_by_id($post_id); $excerpt = wp_trim_words( $content, $length ); return $excerpt; }
before changing <?php echo rpwe_excerpt( $length ); ?> to <?php echo wp_trim_words( get_the_excerpt(), $length ); ?>
Right?
I fixed it by doing this… It may not be the cleanest way to go about it.
I added the following code to my theme functions file (functions.php):
function get_excerpt_by_id($post_id){ $the_post = get_post($post_id); //Gets post ID $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt $excerpt_length = 800; //Sets excerpt length by word count $the_excerpt = strip_tags(strip_shortcodes($the_excerpt)); //Strips tags and images $words = explode(' ', $the_excerpt, $excerpt_length + 1); if(count($words) > $excerpt_length) : array_pop($words); array_push($words, '…'); $the_excerpt = implode(' ', $words); endif; $the_excerpt = '<p>' . $the_excerpt . '</p>'; return $the_excerpt; }
And then I changed the code in recent-posts-widget-extended/includes/widget-recent-posts-extended.php… I changed the function rpwe_excerpt by replacing “get_the_excerpt()” with “get_excerpt_by_id($post_id)” as follows:
function rpwe_excerpt( $length ) { $content = get_excerpt_by_id($post_id); $excerpt = wp_trim_words( $content, $length ); return $excerpt; }
Ok, I guess this is a bug from my plugin. I will fix it soon ??
Wow… thanks! I wouldn’t really call it a “bug”, as the widget works beautifully on most pages… it is just the interaction between the two plugins. But I really, really appreciate all your help ??
Nope. Didn’t work. ??
Could you try to put <?php wp_reset_postdata(); ?> not <?php wp_reset_query(); ?>
Will try this now. Just a second… Thanks!
Here is what the guy on the Modern Tribe Events Calendar forum told me:
The Community add-on uses custom routing and re-writes the WordPress loop in order to display the Event Submission form and other pages. I would suggest modifying the rpwe_excerpt() function to get the excerpt using the post ID. Here’s a good example of getting the_excerpt outside of the WordPress loop: https://uplifted.net/programming/wordpress-get-the-excerpt-automatically-using-the-post-id-outside-of-the-loop/
I would try using that as an example to re-write the rpwe_excerpt() function and see if that does the trick. I hope that points you in the right direction, and feel free to let me know if you have further questions. Thanks
Not sure if this helps… He can’t help me beyond that…
https://tri.be/support/forums/topic/screws-up-recent-post-widget-on-sidebar/
@satrya I think so… Version 0.9?
Forum: Fixing WordPress
In reply to: [PHP HELP] Display the child pages in a specific order?Figured it out… Just had to change “ORDER BY post_title” to “ORDER BY menu_order”
Forum: Fixing WordPress
In reply to: [PHP HELP] Display the child pages in a specific order?Okay so I figured out that is I add
ORDER BY post_title
to the code above in the query it will sort it by the page’s title… is there something like “post_order” that would order it by the page attribute order?
Here is the updated code:
<?php /** * Template Name: Activites Landing Page * Description: * * @package WordPress * @subpackage Jazz_Rib_2012 * @since Jazz and Rib Fest 2012 WordPress Theme */ get_header(); ?> <div id="pageContent"> <table class="pageContentTable"> <tr class="spacing"> </tr> <tr class="regularRow"> <td class="sidebar" valign="top" > <div class="sidebar_wrapper"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('primary-sidebar') ) : ?> <?php endif; ?> </div> </td> <td class="main_page_content" valign="top"> <div id="ContentInset"> <!---Places Page Title----> <?php if (have_posts()) : while (have_posts()) : the_post();?> <h1><?php the_title(); ?></h1> <?php endwhile; endif; ?> <!---Places Page Content----> <?php if (have_posts()) : while (have_posts()) : the_post();?> <?php the_content(); ?> <?php endwhile; endif; ?> <?php $current_page = $post->ID; $querystr = " SELECT * from $wpdb->posts WHERE post_type = 'page' AND post_parent = $current_page ORDER BY post_title "; $child_pages = $wpdb->get_results($querystr, OBJECT); if ($child_pages): foreach($child_pages as $post) : setup_postdata($post); ?> <table class="activityList"> <tr> <td class="activity_logo_cell"> <a href="<?php the_permalink();?>"><?php the_post_thumbnail('Activity_Logo_Small');?></a> </td> <td class="activity_content_cell"> <h2><?php the_title(); ?></h2> <?php $thecontent = $post->post_content; $getlength = mb_strlen($thecontent); $thelength = 350; echo substr(strip_tags($thecontent), 0, $thelength); if ($getlength > $thelength) echo "…"; ?> <a href="<?php the_permalink();?>"><?php _e('[Read More]');?></a> </td> </tr> </table> <h4></h4> <?php endforeach; ?> <?php else : ?> No additional information about activities is currently available. Check back soon! <?php endif; ?> <?php rewind_posts(); ?> </div> </td> </tr> </table> </div> </div> <!---Main Content Wrapper----> <?php get_footer(); ?>
Forum: Fixing WordPress
In reply to: Sorting Output when showing child pages usingUmmm… yeah… no clue what your saying but thanks anyway… I am not a programmer… I know enough code to be dangerous. Beside why would I create a custom menu anyway? That wouldn’t do what I want the page to do… the entire point is to have subpages for each activity…
Can anyone answer the actual question I asked? Vague confusing answers are useless for me… I don’t have the time. Not trying to be rude here… but I need specific answers.