Information on plugin adding text when a post, page, or other such is displayed

Add this filter to functions.php file. Make your changes as needed. function display_my_content( $content ) { if ( is_single() ) { $the_content=”Before your content”; $the_content .= $content; $the_content .= ‘After your content’; return $the_content; } else { return $content; } } add_filter( ‘the_content’, ‘display_my_content’ ); WordPress theme API or plugin API can be used anywhere, … Read more

How to rewrite URL and get the values?

The simplest and quickest solution would be to use the add_rewrite_endpoint function. <?php add_rewrite_endpoint( $name, $places ); ?> So in your case it would be something like this: add_rewrite_endpoint( ‘user’, EP_PERMALINK | EP_PAGES ); An user URL would look like this: http://www.example.com/my-page/user/john To access the variable: $user = get_query_var( ‘user’, false );

Issue with wp_handle_upload

In order to change upload size limit two options have to be changed in php.ini configuration file – upload_max_filesize and post_max_size. These options cannot be changed at runtime so you will need to have access to php.ini in order to modify them. Example: upload_max_filesize = 20M post_max_size = 22M

Copied files from plugin to theme not working

To get the template directory, you can use get_template_directory_uri() like this: $themeDir = get_template_directory_uri(); // … $themeItems = $themeDir . ‘/my_folder/my_items.php’; if (file_exists($themeItems)) return $themeItems; else return $pluginDir . ‘/template/my_items.php’; For more info visit Function Reference/get template directory uri.. If you want to place your PHP code in your theme directory, the better place for … Read more

WordPress Widget Not Saving Instance

The problem is your update function. $old_instance is kind of special variable. The simplest is function update($new_instance, $old_instance) { return $new_instance; } For the safe function update($new_instance, $old_instance) { $instance = array(); $instance[‘name’] = htmlentities($new_instance[‘name’]); $instance[‘divclass’] = htmlentities($new_instance[‘divclass’]); $instance[‘paypal’] = htmlentities($new_instance[‘paypal’]); return $instance; }

How to get terms for taxonomy

Try this code <?php //list terms in a given taxonomy $taxonomy = ‘industry’; $tax_terms = get_terms($taxonomy); ?> <ul> <?php foreach ($tax_terms as $tax_term) { echo ‘<li>’ . ‘<a href=”‘ . esc_attr(get_term_link($tax_term, $taxonomy)) . ‘” title=”‘ . sprintf( __( “View all posts in %s” ), $tax_term->name ) . ‘” ‘ . ‘>’ . $tax_term->name.'</a></li>’; } ?>