Forum Replies Created

Viewing 5 replies - 16 through 20 (of 20 total)
  • Thanks for the tips guys.

    I was having this problem today, all the new blog posts were automaticallly creating a redirect from /blog/ to the post. SO, the homepage couldn’t be viewed.

    Using T8shter’s tip, this is what I did for a plugin hack (look for ‘I ADDED THIS’):

    function create( $details ) {
                    global $wpdb;
    
                    // Auto generate URLs
                    if ( $details['source'] == '' )
                            $details['source'] = Red_Item::auto_generate();
    
                    if ( $details['target'] == '' )
                            $details['target'] = Red_Item::auto_generate();
    
                    // Make sure we don't redirect to ourself
                    if ( $details['source'] == $details['target'] )
                            $details['target'] .= '-1';
    
                    $matcher = Red_Match::create( $details['match'] );
                    $group_id  = intval( $details['group'] );
    
                    if ( $group_id > 0 && $matcher ) {
                            $regex    = ( isset( $details['regex']) && $details['regex'] != false) ? true : false;
                            $position = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$wpdb->prefix}redirection_items WHERE group_id=%d", $group_id ) );
    
                            $action = $details['red_action'];
                            $action_code = 0;
                            if ( $action == 'url' || $action == 'random' )
                                    $action_code = 301;
                            elseif ( $action == 'error' )
                                    $action_code = 404;
    
                            if ( isset( $details['action_code'] ) )
                                    $action_code = intval( $details['action_code'] );
    
                            $data = array(
                                    'url'         => Red_Item::sanitize_url( $details['source'], $regex),
                                    'action_type' => $details['red_action'],
                                    'regex'       => $regex,
                                    'position'    => $position,
                                    'match_type'  => $details['match'],
                                    'action_data' => $matcher->data( $details ),
                                    'action_code' => $action_code,
                                    'last_access' => 0,
                                    'group_id'    => $group_id
                            );
                            if (!in_array(strtolower($data['url']), array('/','/blog/'))) # I ADDED THIS LINE
                            $wpdb->insert( $wpdb->prefix.'redirection_items', $data );
    
                            $group = Red_Group::get( $group_id );
                            Red_Module::flush( $group->module_id );
    
                            return Red_Item::get_by_id( $wpdb->insert_id );
                    }
    
                    return false;
            }
    Gavin

    (@gavinengel)

    I would also *love* to have a Drush for WordPress.

    Following this thread in hopes someone makes one.

    One aspect I really like is the drush sql-cli and drush sql-dump.

    Thread Starter Gavin

    (@gavinengel)

    Hi Esmi,
    Yes, that is possible, but not something I want to do.

    ok will do, thanks

    Rhand, have you found a rotater which can cycle through videos and images? I am looking for one as well.

Viewing 5 replies - 16 through 20 (of 20 total)