Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Do you have any Pages with the same slug as the post type key? There appears to be a WordPress bug with this. From the Easy Post Type FAQs:

    I get a 404 page when trying to view a post of my custom post type

    This can be caused by having a page with the same slug as your custom post type key. The Page does not need to be published (it can even be in the trash) for this issue to exists.

    You will either need to permanently delete the Page or create the a new post type with a different key.

    This is an issue with WordPress rewrite. We are looking into how to workaround the issue.

    I think you need to tell WordPress to keep track of your query var.

    add_filter('query_vars', 'geotag_queryvars' );
    
    function geotag_queryvars( $qvars )
    {
      $qvars[] = 'geostate';
      return $qvars;
    }

    from http://codex.wordpress.org/Custom_Queries

    Sort of. The plugin allows you to set how many posts are displayed depending on the type of index. You could have the category indexes only display 5 posts where as the date indexes will show 8. This will let you set the number of posts for home; but this will also effect the number of posts on page two from home.

    If you want to have only 5 posts on page 1 of indexes and then 10 posts on all the other pages of an index, then this plugin will not do it.

    I’ll recap to make sure I understand. The above code will load the HTML for the widgets but there is no styling for them.

    It sounds like the stylesheets for the widgets are not loading (as Chrisber points outs).

    Read the section “The HTML looks good but the page looks awful in the browser!” in Widgetizing Themes.

    First, do you mean sidebar.php instead of header.php?

    Try adding the dynamic_sidebar function to see if at something at least shows up.

    <div id="sidebar">
    <?php if ( !function_exists('dynamic_sidebar'): ?>
    <?php dynamic_sidebar(); ?>
    <?php endif; ?>
    ...

    There is a plugin to customize how many post display on a page: Different Posts Per Page.

    I used the following snippet, on home.php template, to make the first post on the homepage larger. It adds an extra class to the first post which I use to stylize the post. You can certainly modify it for your use.

    <?php $post_i = 0 ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <li <?php
    	// if it is the first post, then mark it with a special class
    	++$post_i;
    	if($post_i == 1){
    		?>class="first-post"<?php
    	}
    ?>  id="post-<?php the_ID(); ?>">
    
    ...post template stuff here
    
    </li>
    <?php endwhile; ?>
    Forum: Plugins
    In reply to: 2 advanced problems

    I’ll tackle the first one.

    When you are creating/editing the post, go down to “Custom Fields” where you will add a key of “thank_you_url” and then the value will be the actually URL you want to send people to.

    In you template, Just use the following snippet:

    <?php
    $thank_you_url = get_post_meta($post->ID, 'thank_you_url', true);
    if($thank_you_url): ?>
    <a href="<?php echo rawurlencode($thank_you_url); ?>">Thank You</a>
    <?php endif; ?>

    If I understand correctly, iinclude_page(628) returns the content you need except it is not formatted. You need to run through one of the filters that WP uses itself:

    apply_filters('the_content', iinclude_page(628));
     apply_filters('the_excerpt', iinclude_page(628));
    Forum: Plugins
    In reply to: Add noindex tag to pages

    Do you want to add noindex to certain posts or to a certain types of pages (eg. archive pages)?

    If it is the first one, try this plugin: Noindex specific posts and pages. If it is the second, you can add it in you theme header.php and conditional check which type it is:

    <?php if(is_single()): ?>
    <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW" />
    <?php endif; ?>

    I was just working on this myself a week ago.

    Here is the basic of what I have:

    //
    // 1. Register an admin panel
    //
    add_action('admin_menu', 'myplugin__admin_menu');
    
    function myplugin__admin_menu(){
       // adding the admin panel
       $panel_hook = add_submenu_page('edit.php', 'My Panel', 'My Panel', 9, dirname(__FILE__).'/admin-panel.php');
    
       //
       // 2. Register to add the needed javascript to your admin panel
       //
       add_action('admin-panel.php', 'myplugin__admin_print_scripts');
    
       //
       // 3. Register to add the needed CSS to your admin panel
       //
       add_action('admin_print_styles-admin-panel.php', 'myplugin__admin_print_styles');
    }
    
    function au_chapter_description__admin_print_scripts(){
       //
       // 4. Add the following javascripts to the page
       //
       wp_enqueue_script('jquery');
       wp_enqueue_script('tiny_mce');
       wp_enqueue_script('thickbox');
       // thickbox is not totally required, but you never know
    }
    
    function myplugin__admin_print_styles(){
       //
       // 5.Add the following stylesheets to the page
       //
       wp_enqueue_style('thickbox');
    }

    Then in your admin-panel.php:

    <?php
       // I found that you at least need to have div#editorcontainer
       // wrapping the textarea.
    ?>
    <div id="editorcontainer"><textarea name="myplugin_field" type="text" id="myplugin_field" cols="80" rows="20"><?php print $myplugin_field; ?></textarea></div>
    
    <?php
       // Then run this to turn it into the wysiwyg
    ?>
    <script type="text/javascript">
    tinyMCE.execCommand('mceAddControl', true, 'myplugin_field'); 
    
    	</script>

    This does not add the top bar with insert media and switch html/visual buttons. For what I was doing, I did not need them so I didn’t go any further.

    Also, what do you see when you change your code to:

    $output .= "<b href='".get_option('product_list_url')."'>".TXT_WPSC_VISITTHESHOP."</b>";
    ?

    It appears at least one problem is the double quotes inside of the string which confuses the PHP parser.

    Try:

    $output .= '<a href="http://www.soulsilver.co.nz/store">'.TXT_WPSC_VISITTHESHOP."</a>";

    Notice I changed two double quotes to single quotes.

    For more information, read this about strings in PHP http://www.tizag.com/phpT/strings.php .

    If some but not all avatar show up, change the settings for avatar ratings (Settings > Discussion). If it is at G trying bumping it up to PG.

    I haven’t tested the following, but sounds like the basis of what you need in a plugin:

    /**
     * ... Plugin info
     *
     * Shortcode to include a file contents into the post when outputted.
     * [include src="internal/path/to/file.html"]
     */
    
    function shortcode_include_func($atts) {
    	extract(shortcode_atts(array(
    		'src' => '' // set the default to an empty string
    	), $atts));
    
    	if(!empty($src)){ // make sure $src is not an empty string
    		return file_get_contents($src); // return the file as a string
    	} else {
    		return '';
    	}
    }
    add_shortcode('include', 'shortcode_include_func');

    A) I haven’t tested this at all.
    B) There needs to be error checking to make sure the file exists.
    C) The path will be confusing to most people. Perhaps best if it was to match the URL path instead of the internal path.

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