Category Archives: PHP

PHP 4 problem: “Fatal error: Undefined class name ‘self’ “

Installing plugin  FeedWordpress, no problem with Activating process, but the first Syndication got the error: “Fatal error: Undefined class name ‘self’ in /home/directory_name/wp-content/plugins/FeedWordpress/feedwordpress_file.class.php on line 4” Turn out it’s PHP 4 problem (my hosting company hasn’t updated the server to PHP5). Solution: Search file feedwordpress_file.class.php for self:: and replace it with $this-> This should make it work […]

Problem: “Warning: in_array() [function.in-array]: Wrong datatype for second argument”

To fix the problem: Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/sitename/public_html/wptemp/wp-content/plugins/mm-chat/chat.php on line 446  open up your chat.php file and on line 446 where you see “in_array()…” change that to “@in_array()”. Do that to any warnings you’re getting. (Note: This fix is simply a warning suppression.) Solution source: http://getshopped.org/forums/topic/warning-in_array-functionin-array-wrong-datatype-for-second-argument-in/

NextGen Custom Fields plugin: display the custom fields outside the gallery template.

When using the NextGen Custom Fields plugin to create custom fields for your NextGen Gallery’s images and galleries, use the tags below to display these custom fields in the gallery template (gallery.php or gallery_yourtemplate.php): For image custom fields, use the following tag: <?php echo $image->ngg_custom_fields[“Your Field Name Here”]; ?> For gallery custom fields, use the […]

WordPress: Showing an image in the excerpt – using either the_post_thumbnail( ); or Get The Image plugin

Question: I prefer showing only post excerpts on the home page, but I would like a thumbnail image attached to each excerpt. How to achieve this? Answer: Two solutions: 1. Use the new the_post_thumbnail function in WordPress 2.9 Tutorial: http://www.kremalicious.com/2009/12/wordpress-post-thumbnails/ http://poplicola.com/using-the_post_thumbnail-with-wordpress-2-9/ http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature 2. Use Justin Tadlock’s Get The Image plugin. Tutorial: http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin ============================== Important notes for […]

WordPress: Change the Full Post Content to an Excerpt

PHP code: <?php the_excerpt(); ?> ======================== To replace the post’s full content with the excerpt: search for: the_content() and change it to: the_excerpt() ======================== The multi-post displaying template files to change may include: index.php archives.php archive.php category.php search.php Note: Do NOT change it in your single.php or page.php, if you have them in your Theme, as that […]

Thematic Framework: Remove a Thematic action

http://themeshaper.com/guide-customizing-thematic-theme-framework/ ======================================= Here’s the code to put inside your child theme’s function.php: // Remove default Thematic actions function remove_thematic_actions() { remove_action(‘thematic_hookname’,’thematic_actionname’,optionalpostitionnumber); } add_action(‘init’,’remove_thematic_actions’);

WordPress: create a page template that displays posts from a category that has the same name as the page.

Question: How to create a page template that displays all the posts from a category that has the same name as the page itself? Answer: Here’s the code: <?php /* Template Name: ListPostsInCategoryThatHasSameNameAsPage */ ?> <?php get_header(); ?> <div id=”content”> <div id=”main”> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> […]

WordPress: exclude categories from being displayed on home page.

PHP code to put in the file function.php of your child theme: // Used to limit the categories displayed on the home page. function exclude_category($query) { if ( $query->is_home ) { $query->set(‘cat’, ‘-11,-12,-13’); } return $query; } add_filter(‘pre_get_posts’, ‘exclude_category’); Note: replace -11, -12, -13 with the ID# of your categories. =============================== Read more here: http://zeo.unic.net.my/exclude-category-in-wordpress/ […]

FTP problem: can’t see or download more than 1998 files in a single directory

Problem: My directory on the hosting server contains more than 3000 files, and I tried to download the whole content via an FTP program (I use Cyberduck and Filezilla). But I can only see 1998 files, what’s going on? Answer: 05-04-08 05:57 PM – Post#77222 In response to sb1963 Just as you can run different FTP […]

Plugin: NextGEN Custom Fields (for NextGEN Gallery)

http://wordpress.org/extend/plugins/nextgen-gallery-custom-fields/faq/ Displaying Fields For image custom fields, use the following tag: <?php echo $image->ngg_custom_fields[“Your Field Name Here”]; ?> For gallery custom fields, use the following tag: <?php echo nggcf_get_gallery_field($gallery->ID, “My Gallery Field Name Here”); ?> ============================== Edit PHP file: (for larger text area size…) /wp-content/plugins/ngg-custom-columns/ngg-custom-fields.php ============================== Important note: you need have at least 1 image custom field […]