zonirc
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: automatically set the featured imageSorry for a late reply, yes it should be ok in functions.php of the theme.
Another thing, the theme should be enable/support the featured image/post_thumbnail. To do this, you can use something like this:
add_theme_support('post-thumbnails');
To automatically add the 1st image in the post as a featured images, you need to customised it a little bit. Since the code just for assign an image as a featured image/post thumbnail for the post. Probably by hook into post save.
Forum: Fixing WordPress
In reply to: automatically set the featured imageYou can put it into your theme functions.php.
Forum: Fixing WordPress
In reply to: automatically set the featured imageHi jojimori,
This really a late reply but since I’m also had encountered such problem(automatically add images as featured images of the post). For a several days I try to get the solution and do some research in internet. Lastly I found the below solution(where the code is from this codex documentation page. I just make it as a function and added the last line for making it as a featured images.
Hopefully this will help other, remember the $post_id is the parent post ID(where the image been attach) and the $filename is the absolute path of the image files
function set_featured_image($post_id,$filename) { $wp_filetype = wp_check_filetype(basename($filename), null ); $attachment = array( 'post_mime_type' => $wp_filetype['type'], 'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)), 'post_content' => '', 'post_status' => 'inherit' ); $attach_id = wp_insert_attachment( $attachment, $filename, $post_id ); // you must first include the image.php file // for the function wp_generate_attachment_metadata() to work require_once(ABSPATH . "wp-admin" . '/includes/image.php'); $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); if (wp_update_attachment_metadata( $attach_id, $attach_data )) { // set as featured image return update_post_meta($post_id, '_thumbnail_id', $attach_id); } }
Forum: Themes and Templates
In reply to: Determine if the sidebar is activatethanks alchymyth, actually the problem already solved where I checked the sidebar in sidebar.php like you said the logic in header the sidebar are not activated yet ?? so I believe it was my fault…
Anyay thank for correcting me and point the problem ??cheers
Forum: Themes and Templates
In reply to: CSS for social icon placementIf you want to replace the icon then simply replace the images/link-rss.gif to your own image. However, if you want to make a series of different icons, then you can copy the .rss a { … } and give it a different name such as .rss2, .rss-socialicon etc. Then copy/change the background:url(images/link-rss.gif) no-repeat 0 0; to other icon image such as background:url(images/link-socialicon.gif) no-repeat 0 0;
After that find below line(not sure where the author place it-might be in your header.php or other pages)
<span class=”rss”>….</span> and add a new one based on thats. For example: <span class=”socialicon”>….</span>