Michael Fields
Forum Replies Created
-
Forum: Plugins
In reply to: bloginfo string concatenation ngg galleryphp concatenation works a little differently:
<?php print get_bloginfo('url') . '/gallery/?p=35'; ?>Forum: Plugins
In reply to: Isolating part of a URL with PHPThe following code is untested, but the theory should yeild the results you are looking for.
$url = 'http://farm3.static.flickr.com/2085/2177060015_258bcfaff9_m.jpg'; $filename = basename( $url ); $parts = explode( '_', $filename ); $var = $parts[0];Resources
http://us3.php.net/manual/en/function.basename.php
http://us2.php.net/explodeForum: Plugins
In reply to: Hack AddThis plugin to place button outside the_contentyour theme most likely has a category.php or archives.php file in it. you will want to add the same code
<?php do_action( 'custom_social_widget' ); ?>to the loop in these files too.Forum: Fixing WordPress
In reply to: 404 on custom ( non-wordpress ) pagesOK… Figured this one out:
add_filter( 'status_header', 'mf_hack_404', 10 ); function mf_hack_404( $c ) { if( defined( 'GALLERY_NAME' ) ) { $header = '200'; $text = get_status_header_desc( $header ); $protocol = $_SERVER["SERVER_PROTOCOL"]; if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) $protocol = 'HTTP/1.0'; return "$protocol $header $text"; } else return $c; }Please Note that
GALLERY_NAMEis a constant that is defined only in my custom “pages” if you need to use this solution, try setting a constant in your custom script that you can test against.Forum: Plugins
In reply to: Hack AddThis plugin to place button outside the_contentNo problem!
Forum: Fixing WordPress
In reply to: sometimes i want sidebar, sometimes noYou could create a custom page template that does not call the
get_sidebar()function.Forum: Fixing WordPress
In reply to: How to Custom Field show image/thumbnailhmmm… think i need some more infoemation. could you please post all of the code in the file to pastebin and then post a link to the pastebin here? Thanks!
Forum: Themes and Templates
In reply to: Main index file layoutHard to say without knowing which theme you are using…
What theme are you using?
Forum: Plugins
In reply to: Hack AddThis plugin to place button outside the_contentYou’ll have to hack the plugin file. Comment out the line that has:
add_filter('the_content', array(&$this, 'social_widget'));Then create a wrapper function for social_widget()
public function print_social_widget( ){ print $this->social_widget( '' ); }Add a new custom action which will call our wrapper function, this can be placed below the line that we commented out before.
add_action( 'custom_social_widget', array(&$this, 'print_social_widget'));Now go to your template and add the following code to your template files where you would like the button displayed:
<?php do_action( 'custom_social_widget' ); ?>Let me know how this works for you.
Forum: Themes and Templates
In reply to: Main index file layoutHard to say without knowing which theme you are using… If you are using the default theme or a theme that is similar, then you can look at the sidebar file. It’s usually here:
/wp-content/themes/my-current-theme/sidebar.phpForum: Fixing WordPress
In reply to: Removing category from frontpageTaken directly from:
http://codex.ww.wp.xz.cn/Template_Tags/query_posts Please read this page for usage instructions.Exclude Posts Belonging to Only One Category
Show all posts except those from a category by prefixing its ID with a ‘-‘ (minus) sign.query_posts('cat=-3');Hope this helps:)
Forum: Fixing WordPress
In reply to: How to Custom Field show image/thumbnailPlease see this thread for an IMHO better solution to this kinda thing: http://ww.wp.xz.cn/support/topic/209656?replies=11
Note: try the second bit of code that I posted.
If this is not to your liking, you could try the following steps:
First create a directory in your WordPress install directory and put your thumbnail images there. Upload these to your server.
Next come up with a “slug” to use for your image file name. Something like “homepage_thumbnail_filename” would work well.
Next, add a custom field to a post choose “homepage_thumbnail_filename” for the key and type in the name of one of the files in that directory we created in step one. use full name with extension: ‘taco_pudding.jpg’
Open the theme file that displays your homepage and type in the following code into your loop:
$img_filename = get_post_meta( $post->ID, 'homepage_thumbnail_filename' , true ); $path_to_img = get_bloginfo( 'url' ) . '/custom_thumbnail_directory/' . $img_filename; $custom_thumb_img = '<img src="' . $path_to_img . '" alt="" />'; print $custom_thumb_img;This should work. Let me know what happened…
Forum: Fixing WordPress
In reply to: Adding postcontent to category countNo problem!
Forum: Fixing WordPress
In reply to: Adding postcontent to category countNot tested, but it should work 🙂
<?php
$variable = wp_list_categories(‘title_li=&echo=0&show_count=1’);
$variable = str_replace( ‘(‘, ”, $variable);
$variable = str_replace( ‘)’, ‘ entries’, $variable);
echo $variable;
?>Forum: Fixing WordPress
In reply to: Confused about file names: searchform, Search Form and search_formAbsolutely no idea… it’s just a name after all 🙂