Forum Replies Created

Viewing 15 replies - 226 through 240 (of 256 total)
  • Thread Starter DrLightman

    (@drlightman)

    What what are you trying to call in your custom query… a certain category?

    $wpdb->get_results("select * from {$wpdb->prefix}companies limit $offset,5");

    No WP stuff at all, only a listing of rows from a table with a lots of entries.

    Did You select what page your blog would be on… you have to have a page for that too.

    I didn’t at first, because I don’t know yet if I’m gonna write posts for this particular blog. But I added just to test it and I keep getting 404.

    I looked into wp_options and the rewrite rule seems to be in effect:

    [page/?([0-9]{1,})/?$] => index.php?&paged=$matches[1]

    404 keeps popping.

    If I cannot find a wp solution I have to install the “redirection plugin” and set up a pass-thourgh for a custom query var for pagination (/browse/x/ -> /)

    Thread Starter DrLightman

    (@drlightman)

    You may follow these steps to replicate the “bug”/”misbehaviour”:

    1. create a page “foo”
    2. settings>reading, Front page displays as “A static page” and select “foo”.
    3. permalinks settings I use the typical “/%year%/%monthnum%/%day%/%postname%/”
    4. go to yourdomain/ and u see the front page as static page (OK)
    5. go to yourdomain/page/2/ and u should see a 404 (BUG?)

    “I got the solution” without it being posted… that really is awesome.

    Thread Starter DrLightman

    (@drlightman)

    Hi, as I described before, I’m not querying posts (from wp_posts) but companies from a custom table “companies”, so I’m using the generic $wpdb->get_results(“select…”) method.

    But I think the problem is that the frontpage cannot be paginated if set to a static page.

    Thread Starter DrLightman

    (@drlightman)

    Thanks 🙂

    By now I’ve modified the core file adding the “type” filter support, I hate doing that because with the next update I’d forget it for sure 🙁

    Thread Starter DrLightman

    (@drlightman)

    How is possibile that my get_comments function looks like this:

    /**
     * Retrieve a list of comments.
     *
     * The comment list can be for the blog as a whole or for an individual post.
     *
     * The list of comment arguments are 'status', 'orderby', 'comment_date_gmt',
     * 'order', 'number', 'offset', and 'post_id'.
     *
     * @since 2.7.0
     * @uses $wpdb
     *
     * @param mixed $args Optional. Array or string of options to override defaults.
     * @return array List of comments.
     */
    function get_comments( $args = '' ) {
    	global $wpdb;
    
    	$defaults = array('status' => '', 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'number' => '', 'offset' => '', 'post_id' => 0);
    
    	$args = wp_parse_args( $args, $defaults );
    	extract( $args, EXTR_SKIP );
    
    	// $args can be whatever, only use the args defined in defaults to compute the key
    	$key = md5( serialize( compact(array_keys($defaults)) )  );
    	$last_changed = wp_cache_get('last_changed', 'comment');
    	if ( !$last_changed ) {
    		$last_changed = time();
    		wp_cache_set('last_changed', $last_changed, 'comment');
    	}
    	$cache_key = "get_comments:$key:$last_changed";
    
    	if ( $cache = wp_cache_get( $cache_key, 'comment' ) ) {
    		return $cache;
    	}
    
    	$post_id = absint($post_id);
    
    	if ( 'hold' == $status )
    		$approved = "comment_approved = '0'";
    	elseif ( 'approve' == $status )
    		$approved = "comment_approved = '1'";
    	elseif ( 'spam' == $status )
    		$approved = "comment_approved = 'spam'";
    	elseif ( 'trash' == $status )
    		$approved = "comment_approved = 'trash'";
    	else
    		$approved = "( comment_approved = '0' OR comment_approved = '1' )";
    
    	$order = ( 'ASC' == $order ) ? 'ASC' : 'DESC';
    
    	$orderby = 'comment_date_gmt';  // Hard code for now
    
    	$number = absint($number);
    	$offset = absint($offset);
    
    	if ( !empty($number) ) {
    		if ( $offset )
    			$number = 'LIMIT ' . $offset . ',' . $number;
    		else
    			$number = 'LIMIT ' . $number;
    
    	} else {
    		$number = '';
    	}
    
    	if ( ! empty($post_id) )
    		$post_where = $wpdb->prepare( 'comment_post_ID = %d AND', $post_id );
    	else
    		$post_where = '';
    
    	$comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE $post_where $approved ORDER BY $orderby $order $number" );
    	wp_cache_add( $cache_key, $comments, 'comment' );
    
    	return $comments;
    }

    Not even similiar to the one you linked. I thought it was dued to the fact I’m referring to MU but on WP 2.9.2 also I have that. (wp-includes/comment.php) around line 185.

    DrLightman

    (@drlightman)

    Any idea?

    DrLightman

    (@drlightman)

    I also need to make post titles mandatory, I was like O_O omg when I saw my authors publishing a lot of articles without titles 😐

    DrLightman

    (@drlightman)

    Very useful trick, it fixed the same problem for me.
    Thanks.

    Forum: Plugins
    In reply to: e-commerce plugin?
    DrLightman

    (@drlightman)

    Is someone using that plugin succesfull?

    DrLightman

    (@drlightman)

    Keep up the good work :approved:

    DrLightman

    (@drlightman)

    Too bad. Does a replacement exist to manage events?

    Thread Starter DrLightman

    (@drlightman)

    Last time I imported wp_terms_* tables from another installation into a fresh installation.

    All went fine, tags were imported, categories also were imported and appeared correctly in the admin Post page. But in the Categories management page only parent categories were showed. I discovered an option named “category_children” into wp_options that is used by that page to display child categories, so I had to copy that option also from the old database.

    I wonder if it could be recalculated automatically since the wp_terms_* strcture should be enough to build the categories tree.

    Thread Starter DrLightman

    (@drlightman)

    Another thing I would suggest the plugin author, is not to use wp_die() on modules if main plugin is not installed. I think a flash message warning would be enough (“Fan Box need the sfc plugin to be activated first”)

    This because wp_die broke a blog activation in a wpmu installation while using an Auto Activation Tool, since the order of activation was not the one needed by sfc modules. SO every latter plugin were not activated.

    Thread Starter DrLightman

    (@drlightman)

    For now I did this way:

    <?php echo sfc_fanbox_shortcode(array('width'=>'290','height'=>'200','stream'=>'0')); ?>

Viewing 15 replies - 226 through 240 (of 256 total)