Upload featured image on custom post from wordpress front-end

When you are working with wordpress custom post type and you need to allow user can submit new posts where On each post you need to upload photo of the post also that can be a featured image then you need to follow below codes to upload attachmends and to make it featured.

//Just uploading photo or attachments
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');
         

//$file_handler = 'upload_attachment' //Form attachment Field name.
$attach_id = media_handle_upload( $file_handler, $post_id );


//making it featured!
set_post_thumbnail($post_ID, $attach_id );
or
update_post_meta($post_id,'_thumbnail_id',$attach_id);

404 Page Not Found after custom form submission on wordpress

Sometimes it’s happen! when you submit a wordpress form it says ‘Page Not Found!’ or Saying ‘This is somewhat embarrassing, isn’t it?It seems we can’t find what you’re looking for. Perhaps searching, or one of the links below, can help.’

But your defined page action has a valid url and all post values are available too on that same page. Also if you submit that form as empty input that it works fine!

If this is the case then The problem is by the “name” parameter you posted from your form. WordPress has some reserve parameter for internal use like client_name, author_name etc

So you just need to try with renaming your form fields. Hope it will solve it!

Replacing media urls on wordpress posts

Sometimes we work for a website with wordpress keeping the development version on sub directory. Say are working for http://www.example.com website and currently it is live and we work for it’s new version in wordpress. So we setup a new wordpress version on new folder so the current development version is http://www.example.com/new

When we are done with all development and uploaded all contents on that new setup that means all media files and contents media urls are targeting with http://www.example.com/new

So when we are going to make the site live we need to do something manually to replace media paths for contents. Or if we directly copy contents from another hosting in that case same things will happen.

For the faster replacement of each media guid, contents media url or other meta values below mentioned 3 mysql query is nice.

Note: After running below code we need to ensure that all wp-contents/uploads folders contents are available as it was on new development directory.

update wp_posts set guid = replace(guid, 'http://www.example.com/new', 'http://www.example.com')

update wp_posts set post_content = replace(post_content, 'http://www.example.com/new', 'http://www.example.com')

update wp_postmeta set meta_value = replace(meta_value, 'http://www.example.com/new', 'http://www.example.com')

update wp_options SET option_value = 'http://www.example.com' WHERE option_name = 'home' OR option_name = 'siteurl';

 

With this above queries below listed things will happen –
1. Replace all resource or post guid
2. Replace all old media src url to new src url in post contents
3. Replace all meta resource url like image, video or audio etc
4. Replace site home page and siteurl url

Replacing post content attachment url for wordpress new setup

When working with wordpress sometime we need to copy full site content with new wordpress site setup. If you use wordpress default inport / export then all content and resource source url works fine but all image or attachment source url in content is keeping it’s old values.

To replace those old source url to new site url you can add a wordpress filter like my below given one.

Note: You need to copy uploads folder to your new server.

function replace_phpfarmer_url($content){
    $content = str_replace('http://olddomain.com/', 'http://newdomain.com/', $content);
    return $content;
}
add_filter('the_content', 'replace_phpfarmer_url');

dd simple photo gallery version 1.1 has been released

Finally the dd simple photo gallery version 1.1 has been released. I tried to make it more easy to use that’s why I have removed the timthumb image resizing on the fly which required some server manual settings.

dd simple photo gallery version 1.1 features:

1. added around 40 different effects on photo sliding
2. above 15 settings you can choose when the plugins call
3. timthumb on the fly photo resize has been removed
4. support for multiple photo gallery on a single page or post

the complete list of different effect and settings is not configurable on gallery settings page yet, very soon it will be added on gallery settings page.

for more discussion please visit http://www.dropndot.com/blog/development/ddspg-version-1-1-has-been-released/

thanks

dd simple photo gallery wordpress plugin

It is to introduce my recently developed wordpress simple photo gallery plugins. If you are maintaining a wordpress enabled website, If you are searching for a photo gallery which is simple to use, simple to modify to developer and simple in looks then you are quitely invited to use this “dd simple photo gallery”.
From the begining of the release version 1.0 of this wordpress plugins I got a lot of thanks giving email and bug report. Some of discussion already available on this plugins home page http://www.dropndot.com/blog/wordpress/dd-simple-photo-gallery-wordpress-plugin/

You can download it from wordpess extension directory here http://wordpress.org/extend/plugins/dd-simple-photo-gallery/ to know more about this you can review the discussion on http://www.dropndot.com/blog/wordpress/dd-simple-photo-gallery-wordpress-plugin/
Read More

404 error – page not found – wordpress

If you are a wordpress user or a wordpress developer then sometimes you may noticed a error when you are trying to view a post or page Like:

Error 404: NOT FOUND!
Your browser cannot find the document corresponding to the URL you typed in.

Sometimes it will happen when your permalinks is not accepted as valid on wordpress. If the permalinks settings is not valid then you can fix this error your wordpress admin panel. Just go to the settings tabs permalinks settings, then select a default settings. Then test your site.

If it seems your error is fixed then search on wordpress for any article about using permalinks to use custom permalinks.