refulez
Forum Replies Created
-
yes, please explain , it does not work for me either. Thanks
Forum: Hacks
In reply to: Adding attachment to post using wp_insert_postForum: Hacks
In reply to: Get and resize Thumbnails with images taken from custom fieldsthanks!
here is the script in case someone else is looking for something like this
$value is the filename $save_path = "folder/"; $file = realpath($save_path).'/'.$value; $wp_filetype = wp_check_filetype(basename($file), null ); // Construct the attachment array $attachment = array( 'post_mime_type' => $wp_filetype['type'], 'guid' => $file, 'post_title' => preg_replace('/\.[^.]+$/', '', basename($post_name)), 'post_content' => '', 'post_parent' => $post_id, 'post_status' => 'inherit' ); // Save the data $id = wp_insert_attachment($attachment, $file, $post_id); $attach_data = wp_generate_attachment_metadata( $id, $file ); wp_update_attachment_metadata( $id, $attach_data ); set_post_thumbnail( $post_id, $id );
Forum: Hacks
In reply to: Get and resize Thumbnails with images taken from custom fieldsi’m uploading them to a folder on the server and the i have a script that parses the folder and inserts into the database the link to the image.
so any idea how to use a custom field for the thumbnail generation?
Forum: Hacks
In reply to: Get and resize Thumbnails with images taken from custom fieldsi have a script that inserts the link of the image into the custom field. but what i need is: the wordpress thumbnail generator to use that image and generate thumbs of other sizes.
so i don;t have to use resizing scripts like timthumb.
so how do i get the wordpress thumbnail generator to use the image in a custom field?
Forum: Plugins
In reply to: Random posts Without repeating themthe posts are being repeated in the codex
i wanted a script that would Not repeat the already seen posts if ordered randomly.
Thanks.
Forum: Fixing WordPress
In reply to: Random posts on a pagei found a solution `<?php query_posts(array(
‘orderby’ => ‘rand’
));
if (have_posts()) : while (have_posts()) : the_post();?>`
is there a way to excude already seen posts?
and any idea on how to paginate it ?
i have something in place<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>
but it only pagintes the mainpage not the page template i created for the random posts
the pagenavi function in integrated in the theme it looks like thisfunction wp_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = true) { global $request, $posts_per_page, $wpdb, $paged; if(empty($prelabel)) { $prelabel = '<strong>«</strong>'; } if(empty($nxtlabel)) { $nxtlabel = '<strong>»</strong>'; } $half_pages_to_show = round($pages_to_show/2); if (!is_single()) { if(!is_category()) { preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches); } else { preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches); } $fromwhere = $matches[1]; $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere"); $max_page = ceil($numposts /$posts_per_page); if(empty($paged)) { $paged = 1; } if($max_page > 1 || $always_show) { echo "$before <div class='Nav'><span>Page $paged of $max_page</span>"; if ($paged >= ($pages_to_show-1)) { echo '<a href="'.get_pagenum_link().'">« First</a> ... '; } previous_posts_link($prelabel); for($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { if ($i >= 1 && $i <= $max_page) { if($i == $paged) { echo "<strong class='on'>$i</strong>"; } else { echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> '; } } } next_posts_link($nxtlabel, $max_page); if (($paged+$half_pages_to_show) < ($max_page)) { echo ' ... <a href="'.get_pagenum_link($max_page).'">Last »</a>'; } echo "<div class='NavEnd'></div></div> $after"; } } } ?>
Forum: Fixing WordPress
In reply to: problem with urlhttps://sms.urdugold.com/wp-admin redirects to https://sms-ghar.com/wp-login.php you need to change it in htaccess or in youre wordpress settings
Forum: Fixing WordPress
In reply to: li ul in the sidebar problemi don’t why i din’t try that
but it worked thanks a milionForum: Fixing WordPress
In reply to: li ul in the sidebar problem<?php if ( function_exists('register_sidebar') ) register_sidebar(array( 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>', )); register_sidebar(custom,array( 'name' => 'custom', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>', )); ?>
i already have that in place but it’s not working on the first sidebar it works but on the second it’s not working
Forum: Fixing WordPress
In reply to: Using Tags as Meta Keywords<meta name="keywords" content="<?php if ($posttags) { foreach($posttags as $tag) { echo $tag->name . ' '; } } ?>" />
try this
Forum: Fixing WordPress
In reply to: feed error please help!it was the seo plugin thaks!but i have another problem now when i try to burn the feed with feedburner it doesn’t see it as a valid feed it gives me a error any thoughts?
Forum: Fixing WordPress
In reply to: How to find and edit htaccess file ?you need to go to the www folder of your xampp instal and then to the folder with your domain name and there should be a file called .htaccess there if the isn’t you need to create a new file and rename it .htaccess
you can open and edit it using notepad or any other text editor