Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • yes, please explain , it does not work for me either. Thanks

    Thread Starter refulez

    (@refulez)

    thanks!

    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 );
    Thread Starter refulez

    (@refulez)

    i’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?

    Thread Starter refulez

    (@refulez)

    i 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?

    Thread Starter refulez

    (@refulez)

    the posts are being repeated in the codex

    i wanted a script that would Not repeat the already seen posts if ordered randomly.

    Thanks.

    Thread Starter refulez

    (@refulez)

    i 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 this

    function 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>&laquo;</strong>';
    
    	}
    
    	if(empty($nxtlabel)) {
    
    		$nxtlabel = '<strong>&raquo;</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().'">&laquo; 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 &raquo;</a>';
    
    			}
    
    			echo "<div class='NavEnd'></div></div> $after";
    
    		}
    
    	}
    
    }
    ?>

    Forum: Fixing WordPress
    In reply to: problem with url

    https://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

    Thread Starter refulez

    (@refulez)

    i don’t why i din’t try that
    but it worked thanks a milion

    Thread Starter refulez

    (@refulez)

    <?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

    <meta name="keywords" content="<?php
    	if ($posttags) {
    		foreach($posttags as $tag) {
    			echo $tag->name . ' ';
    		}
    	}
    ?>" />

    try this

    Thread Starter refulez

    (@refulez)

    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?

    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

Viewing 13 replies - 1 through 13 (of 13 total)