Forum Replies Created

Viewing 15 replies - 376 through 390 (of 482 total)
  • Forum: Themes and Templates
    In reply to: WP Navigation

    The $after argument is what you’re after.

    <?php $defaults = array(
      'theme_location'  => ,
      'menu'            => ,
      'container'       => 'div',
      'container_class' => ,
      'container_id'    => ,
      'menu_class'      => 'menu',
      'menu_id'         => ,
      'echo'            => true,
      'fallback_cb'     => 'wp_page_menu',
      'before'          => ,
      'after'           => ' | ',
      'link_before'     => ,
      'link_after'      => ,
      'depth'           => 0,
      'walker'          => );
    ?>

    Items should get a dynamic class applied to them that you can style. Or you can always do .menu li if you want to style them all.

    Forum: Themes and Templates
    In reply to: Page Templates

    You’d just need to create one page template and you can apply it all those pages.

    http://codex.ww.wp.xz.cn/Pages#Creating_Your_Own_Page_Templates

    If the sidebar content is going to be the same, you’d just need to register one additional widget area, and call that from you page template.

    I’d say that’s the simplist way to do it.

    If you want to try another more advanced route, you could use custom post types:

    http://codex.ww.wp.xz.cn/Custom_Post_Types

    To do that, you would add something like this to your functions.php:

    add_action( 'init', 'create_post_type' );
    
    function create_post_type() {
      register_post_type( 'bios,
        array(
          'labels' => array(
            'name' => __( 'Bios' ),
            'singular_name' => __( 'Bios' )
          ),
          'public' => true
        )
      );
    }

    Then you could create a template called single-bios.php that it would use.

    The downfall is that there is no multiple template yet (to display all your bios on one page). But that should be out shortly in WordPress 3.1, and then you would just need to create a template called: archive-bios.php.

    This might be a more interesting route if you needed add extra metaboxes for data about each person who has a bio, or use additional taxonomies.

    If any of that is confusing, just go back up to option 1. 🙂

    That seemed to fix it. Thanks.

    Thread Starter Devin Price

    (@downstairsdev)

    Okay, think I got this resolved to be more what I wanted:

    function wpt_strip_content_tags($content) {
    	$content = strip_shortcodes($content);
    	$content = str_replace(']]>', ']]>', $content);
    	$content = preg_replace('/<img[^>]+./','',$content);
    	return $content;
    }

    Display:

    $excerpt_content = get_the_content('');
    echo wpt_strip_content_tags($excerpt_content);
    Forum: Your WordPress
    In reply to: Portfolio Theme
    Thread Starter Devin Price

    (@downstairsdev)

    Just saw this. Would you want to send the translation over to me at devin [at] wptheming.com? I’m going to include a Spanish translation in the next version as well.

    I have a theme in the repo that handles all this:
    http://ww.wp.xz.cn/extend/themes/portfolio-theme

    I basically used Jake Goldman’s plugin as a drop in:
    http://ww.wp.xz.cn/extend/plugins/simple-custom-post-type-archives/

    I wrote a step by step guide for adding metaboxes to custom post types. Perhaps it’ll be helpful: http://wptheming.com/2010/08/custom-metabox-for-post-type/

    This is not exactly what you asked for, but could be solution for someone. It sets up metabox items with a date prepopulated, much like how the “publish date” works.

    Callback:

    // Add the Events Meta Boxes
    
    function add_events_metaboxes() {
    	add_meta_box('wpt_events_date', 'Event Date', 'wpt_events_date', 'events', 'side', 'default');
    }

    Build the metabox:

    // The Event Date Metabox
    
    function wpt_events_date() {
    	global $post, $wp_locale;
    
    	// Use nonce for verification ... ONLY USE ONCE!
    	echo '<input type="hidden" name="ac_noncename" id="ac_noncename" value="' .
    	wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
    
    	$time_adj = current_time('timestamp');
    
    	$month = get_post_meta($post->ID, '_month', true);
    
    	if ( empty($month) ) {
    		$month = gmdate( 'm', $time_adj );
    	}
    
    	$day = get_post_meta($post->ID, '_day', true);
    
    	if ( empty($day) ) {
    		$day = gmdate( 'd', $time_adj );
    	}
    
    	$year = get_post_meta($post->ID, '_year', true);
    
    	if ( empty($year) ) {
    		$year = gmdate( 'Y', $time_adj );
    	}
    
    	$hour = get_post_meta($post->ID, '_hour', true);
    
    	if ( empty($hour) ) {
    		$hour = gmdate( 'H', $time_adj );
    	}
    
    	$min = get_post_meta($post->ID, '_minute', true);
    
    	if ( empty($min) ) {
    		$min = '00';
    	}
    
    	$month_s = "<select name=\"_month\">\n";
    	for ( $i = 1; $i < 13; $i = $i +1 ) {
    		$month_s .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';
    		if ( $i == $month )
    			$month_s .= ' selected="selected"';
    		$month_s .= '>' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) . "</option>\n";
    	}
    	$month_s .= '</select>';
    
    	echo $month_s;
    
    	echo '<input type="text" name="_day" value="' . $day  . '" size="2" maxlength="2" />';
    	echo '<input type="text" name="_year" value="' . $year . '" size="4" maxlength="4" /> @ ';
    	echo '<input type="text" name="_hour" value="' . $hour . '" size="2" maxlength="2"/>:';
    	echo '<input type="text" name="_minute" value="' . $min . '" size="2" maxlength="2" />';
    
    }

    Save the data:

    // Save the Metabox Data
    
    function wpt_save_events_meta($post_id, $post) {
    
    	// verify this came from the our screen and with proper authorization,
    	// because save_post can be triggered at other times
    	if ( !wp_verify_nonce( $_POST['ac_noncename'], plugin_basename(__FILE__) )) {
    	return $post->ID;
    	}
    
    	// Is the user allowed to edit the post or page?
    	if ( 'page' == $_POST['post_type'] ) {
    		if ( !current_user_can( 'edit_page', $post->ID ))
    		return $post->ID;
    	} else {
    		if ( !current_user_can( 'edit_post', $post->ID ))
    		return $post->ID;
    	}
    
    	// OK, we're authenticated: we need to find and save the data
    	// We'll put it into an array to make it easier to loop though.
    
    	$events_meta['_month'] = $_POST['_month'];
    	$events_meta['_day'] = $_POST['_day'];
    	$events_meta['_year'] = $_POST['_year'];
    	$events_meta['_hour'] = $_POST['_hour'];
    	$events_meta['_minute'] = $_POST['_minute'];
    
    	$events_meta['_location'] = $_POST['_location'];
    
    	// Add values of $events_meta as custom fields
    
    	foreach ($events_meta as $key => $value) { // Cycle through the $events_meta array!
    		if( $post->post_type == 'revision' ) return; // Don't store custom data twice
    		$value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)
    		if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value
    			update_post_meta($post->ID, $key, $value);
    		} else { // If the custom field doesn't have a value
    			add_post_meta($post->ID, $key, $value);
    		}
    		if(!$value) delete_post_meta($post->ID, $key); // Delete if blank
    	}
    
    }
    
    add_action('save_post', 'wpt_save_events_meta', 1, 2); // save the custom fields

    The data should be checked a bit further to make sure each item is an integer, etc- but this works for now.

    Thread Starter Devin Price

    (@downstairsdev)

    Okay. Thanks Sam.

    Forum: Plugins
    In reply to: Custom post types & rewrite

    Hey Paul. Thanks for all your work on this and support you’ve been doing in the forums.

    I’m also not having any luck getting the file to show up in Dropbox- though the plugin does give me a green box and says everything was successful.

    Here’s the log: http://wptheming.com/wp-content/wpTimeMachine_log.txt

    That’s exactly correct.

    Try switching between the default theme and the sliding doors theme. You’ll see that the appearance of your site is different, but the content you wrote is still there.

    View the source on your website and grab all the inline css that is displayed.

    Then add this line to your functions file:

    remove_action( 'wp_head', 'smooth_slider_css');

    That will remove all the inline css.

    Now paste the inline css into your styles.css file. You’ll be looking for the margin right on the thumbnail. I set mine to 20px.

    .smooth_slider_thumbnail {
    	float:left;
    	margin:0px 20px 0 0px;
    	width:320px;
    	height:220px;
    }
Viewing 15 replies - 376 through 390 (of 482 total)