jessekanner
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: PDF Thumbnails no longer being generatedThis worked for me as of 2021-08-27
$attachment_id = array_keys(get_attached_media('*,*',$post->ID))[0]; echo wp_get_attachment_image( $attachment_id, 'full', $icon, $attr );
Are you sure you’re running php5 ? I just got tripped up on this on my MediaTemple account which for no good reason defaults to php4 when I create a new instance. I changed to php5 an did not get the error when activating.
Forum: Plugins
In reply to: [Plugin: WP-Weather] Short Code in sidebar instead of widgetHere are two ways of getting [short-codes] to display in your sidebar (outside the Loop).
https://englishmike.net/2008/07/07/wordpress-quick-tips-3adding-a-shortcode-to-a-sidebar-widget/
Login to your blog’s administration pages and go to the Theme Editor — i.e. select Design >> Theme Editor from the admin menu. Look in the list of Template Files on the right of the page for one called Theme Functions or functions.php and click on it to load it into the editor. Find a place between the <?php and ?> tags which is not in the middle one of the functions that may already be in the file (the very top or bottom of the file are both good places) and add the following line: add_filter('widget_text', 'do_shortcode'); Click on the Update File button to save the modified template. That’s all you need to do. Now any shortcodes you add to a sidebar widget will be correctly processed by the plugin they belong to. The easiest way to test this is as follows: Go to Design >> Widgets using the administration menu. Find the Text widget in the list on the left, and click its Add button. Click on the new widget’s Edit link, and enter a title for the widget and then add the shortcode below it. Click the Change button, then click the Save Changes button (easy to forget) and then go to the front page of your blog to see your new shortcode-enabled widget.
…also:
To use your shortcodes outside of posts, pages, and the text widget, you could always call your shortcode function directly like this: $text = yourShortCodeFunction(‘[your shortcode tag here]‘); echo $text;
Forum: Fixing WordPress
In reply to: is_page not “completely” workingHad a similar problem… none of my is_page() detection functions were working, until I added this to the top of my sidebar.php file.
wp_reset_query();
Thanks Llasse!
Forum: Fixing WordPress
In reply to: Image bullets in sidebar links…I just made a tweak to my WP 2.1 setup to show both the name and image of the link.
This doesn’t per-se address the BOY/GIRL scenario outlined above, but it does allow me now to just set the image URL for each link using WP admin and have both show up.
I edited the wp-includes/bookmark-template.php file thusly:
if ( $row->link_image != null && $show_images ) { if ( strpos($row->link_image, 'http') !== false ) #$output .= "<img src=\"$row->link_image\" $alt $title />"; $output .= "<img src=\"$row->link_image\" $alt $title /> " . $name; else // If it's a relative path #$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title /> " . $name; } else {
The commented lines were how I found them in the default build, my modifications just below. All I did was add the $name variable to the output. I had to do it on two lines – one for when the image is local(relative) and one for when it’s absolute.