Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter robbono

    (@robbono)

    I have neither in my code.

    Note: I’ve also read through Otto’s responses on the automattic mailing list, as seen here:

    https://lists.automattic.com/pipermail/wp-testers/2010-May/013017.html

    If I read this correctly, he seems to be saying that Permalinks for custom content types won’t work at all if you have %postname% in your Settings > Permalinks permalink structure. Can someone confirm for me that this is true?

    If so…well, that’s a little klorbed, I suppose, since almost everyone I know uses %postname% in their permalinks for SEO purposes.

    I am having the

      exact

    same problem as the original poster described.

    I have my overall permalink structure set to:
    /%category%/%postname%.

    If I browse to
    https://mysite.com/?event=heres-a-title

    I get redirected successfully to
    https://mysite.com/event/heres-a-title/?event=heres-a-title

    But if I browse to the link that WordPress generates:
    https://mysite.com/event/heres-a-title/

    I end up with a 404.

    I’ve tried to rebuild my .htaccess file using Settings > Permalinks, but this has not fixed the issue.

    I don’t expect the custom content types to work with with my permalink structure in terms of categories; I only expect that the Rewrite function for WordPress’s register_post_type() function will work as described. Unfortunately, it does not seem to work.

    Changing my permalink structure doesn’t fix the problem.

    Is there anyone out there who has actually successfully implemented custom post types with url rewriting?

    For your reference, the code I’m using is:

    'add_action( 'init', 'create_post_type' );
    function create_post_type() {
    register_post_type( 'event',
    array(
    'labels' => array(
    'name' => __( 'Events' ),
    'singular_name' => __( 'Event' )
    ),
    'public' => true,
    'rewrite' => true,
    'show_ui' => true, // UI in admin panel
    '_builtin' => false, // It's a custom post type, not built in!
    '_edit_link' => 'post.php?post=%d',
    'capability_type' => 'post',
    'hierarchical' => false,
    'supports' => array('title','author')
    )
    );
    }

    Is this a bug? Misconfiguration on my end? A misunderstanding of what “rewrite” means in the Codex? Any help would be much appreciated.

    Having the exact same problem – all comments seem to be ending up in the spam queue. Any ideas on some steps I can take to fix this?

    It’s my first time installing the plugin, so there’s nothing buggy left over from previous installations.

    I’m installing on WordPress 2.8.4

    Thanks!

    @stvwlf – Yep, I could use $post->post_content, but what I’m trying to display is a poll using WP-Polls – so the content only displays as [poll-id: 8], which triggers WP-Polls to display the poll. It only works when it’s run through the_content(), not when echoed as a variable. My knowledge of filters doesn’t go far enough for me to figure out how to get it to trigger WP-Polls plugin, so I’m just going to have to hide the block until the sidebar issue is fixed.

    BTW, I’m using a custom WP-Query, but there’s a reported bug with WordPress not clearing out globals on the 2nd page (even when using wp_reset_query() ), so no matter what I do, the_content() always displays the wrong content – but that’s a topic for another post.

    Thanks again for the conditional advice! I’ll be using that for now!

    Great! At least if I can’t fix the sidebar the_content() bug, I can disable the block in question on the 2nd and later posts. Thanks again!

    Thread Starter robbono

    (@robbono)

    There is a .diff patch attached to

    https://core.trac.www.ads-software.com/ticket/9256

    that supposedly fixes the problem by resetting a bunch of globals that WordPress leaves around in wp_reset_query.

    I’ve implemented the patch, and done a wp_reset_query(); both immediately before and immediately after the sidebar loop, as shown here:

    <?php
    wp_reset_query();
    $polls_cat = "45";
    $poll_query = new WP_Query('cat='.$polls_cat.'&showposts=1&orderby=date&order=DESC');
    while ($poll_query->have_posts()) : $poll_query->the_post(); wp_reset_query(); ?>
    <h2 id="pollboxtitle"><?php the_title(); ?></h2>
    <div id="featuredpicture">
    <img height="200px" width="300px" src="<?php echo get_post_meta($post->ID, 'thumbnail',true); ?>" alt="Post Image" class="postimg" />
    <div class="caption"><?php echo get_post_meta($post->ID, 'thumbnailcaption',true); ?></div>
    </div> <!-- /featuredpicture -->
    <?php the_content('');
    ?>
    <?php endwhile; ?>

    However, the problem is still there. Am I using wp_reset_query() wrong here? I’m using it in single.php as well as in the sidebar, and no matter where I bust it out, I’m always seeing the content of the post in the sidebar.

    So…still not working, and the Trac report has been closed, meaning that it’s apparently been shown to work. What am I doing wrong here?

    I have the same question. There is a bug in WordPress that causes the_content not to work properly in sidebars after pagination (i.e., the_content() works in sidebars on page 1 of a paginated post, but not on subsequent pages 2, 3, 4, 5, etc).

    Because of this, I want to disable a sidebar block based on whether or not it’s the first page of a paginated post. Therefore, the aforementioned solution (for styling purposes) will not work for me.

    WordPress has some way of knowing what page it is – some kind of property. What is this property, and how can I create a conditional statement using it?

    Thanks!

    I’m having this exact same problem as documented here:

    https://www.ads-software.com/support/topic/311568?replies=6#post-1214730

    This bug was reported six months ago, yet it doesn’t seem to have been fixed yet.

    In my case, I cannot simply echo $post->post_content; because I’m trying to display a poll using WP-Polls, and WP-Polls only renders the content when it’s accessed through the_content(); when I echo the post_content, I see this:

    [poll id="28"]

    Which is the tag for WP-Polls to display a poll.

    Any ideas on how I can get this to work? Barring that, is there a conditional tag I can use to check if the post is showing paginated pages 2,3,4,5, etc, so that I can simply remove this block from display on those pages until the bug is fixed?

    Thread Starter robbono

    (@robbono)

    Well, it worked, and it didn’t. Although it solved the problem, now the block is showing the following:

    [poll id="28"]

    Which is the template tag that WP-Poll uses to display a particular poll. It seems that WP-Polls will only render a poll when it’s accessed through the_content() – which means that I have a problem, since the_content() doesn’t seem to be working in sidebars.

    Anyone have any suggestions, or know anything about this bug? In the WP Trac, it says “Milestone -> 2.8”, but I’m using 2.8 and the bug isn’t fixed.

    Ideas?

    Thread Starter robbono

    (@robbono)

    I’ve done some more Googling and have found some more posts on the topic. It seems that a temporary workaround is to use echo $post->post_content. More information here:

    https://www.ads-software.com/support/topic/248632?replies=3

    and a WordPress Trac report here:

    https://lists.automattic.com/pipermail/wp-trac/2009-March/039961.html

    I’m going to test out the workaround now and I’ll post up here for other people who want to use the_content() in the sidebar if it works.

    Thread Starter robbono

    (@robbono)

    Hi t31os_ – thanks for the suggestion! However, when I tried changing the code as you suggested, as such:

    $polls_cat = "45";
    $poll_query = new WP_Query('cat='.$polls_cat.'&showposts=1&orderby=date&order=DESC');
    while ($poll_query->have_posts()) : $poll_query->the_post(); setup_postdata($posts); ?>
    ...
    <?php the_content('');

    Unfortunately, it didn’t have any effect on the problem – I still see the content of the second page of the paginated post when I try to use the_content() in the sidebar loop query I’ve created. Any other thoughts?

    Thread Starter robbono

    (@robbono)

    One addendum to this post – I previously stated the the_content() was appending the post’s content; in fact, it is replacing the post’s content – the actual poll content is the voting block area (this is all accomplished using Lester Chan’s wp-polls plugin). The voting block itself is not showing; rather, the post’s content is being output here.

    That simple <?php wp_reset_query(); ?> just totally rocked my world – I, too, use a highly customized frontpage with multiple loops, and I wanted to check is_home() in the header.php to selectively load image preloading scripts and other heavy javascripts.

    is_home was totally borked until I used the wp_reset_query() right in front of the conditional, and now it works perfectly! Rock on! Thanks to t31os_ and tammyhart for the quick and easy solution!

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