Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • Forum: Plugins
    In reply to: Get Parent Pages

    Oh, hi moshu, guess I caught you in a foul mood that day. I wasn’t trying to promote anything, the site’s actually a private site I only show people when I happen to have a solution that might work. I was doing some research on this for myself, relating to a similar but different issue, and came across this post – thought I could help. Obviously I misunderstood what was trying to be accomplished, but there’s no need to be nasty. I admit I didn’t read all of the responses, just the initial question posed.

    And yes, of course, if you need something different for each of 57 pages, that would probably require a lot more work, although you wouldn’t need 57 conditionals, just one conditional that outputs the page slug or id. But in most cases this is never something I would need to do, so I’ll stay out of this one! ??

    Huh. Interesting. Still… it would make sense for pages to already be treated as pages anyway. I appreciate you clearing that up for me.

    Good question! Textpattern has the custom field settings in the admin area instead of right there in the post, which means only someone with admin level could change them. Maybe there’s a way to set custom fields as unwritable based on user levels?

    You need both the default page.php AND another Page template to be present in your theme folder for the dropdown to appear.

    Why is that? I’m just curious because I run into this frequently and it’s a pain to create a page.php template I don’t need just to use a custom page template.

    I came across this thread in a search for something else, but I have a solution for anyone who has multiple blog authors.

    This will allow you to set the class for a comment based on who wrote a post instead of just the blog owner:

    Different Content for Different Authors

    oh! i had a hunch just now and tried something and it worked! Try this:

    <?php
    $by_john = false;
    if($post->post_author == '1') {
    $by_john = true;
    }
    ?>
    
    // then inside the loop...
    
    <?php if($by_john) { ...do stuff for john... } ?>

    Change the number 1 to john’s author ID

    btw, this tip works great in the body tag as well, setting a class/id to the body based on whatever page you’re on, then using CSS to display/style things at will.

    On my sites I essentially have this (but much more involved):

    <body id="<?php echo $slug; ?>" class="<?php if(is_single()) { echo 'single by-'; the_author_login(); } ?>">

    Which gives me something like this:

    <body id="post-slug" class="single by-john">

    oh yeah, slug relies on another piece of code in the <head>:

    
    <?php
        $post_id = get_post($post->ID); // get current post or page
        $slug = $post_id->post_name; // define its slug as $slug
    ?>
    

    hope that helps. I’ve had a number of headaches to get these things to work, but it’s beautiful that WP allows us such freedom to do all of this. ??

    I’ve tried to do something similar to this, which is how I found this thread. The way I understand is_author though is that it means “if we’re on an author page”, then narrowing it down, “if we are on _john’s_ author page”. Outside of author pages, there’s no way to say “if _this post_ is by john”.

    The only thing I’ve been able to do is with CSS:

    <div class="single" id="<?php the_author_login(); ?>">

    Then, style that page differently:

    #john div.blurb { styles for john here }

    What you _could_ do maybe is put the include there but say display:none, then display:block just for john.

    This might be a dumb question but when you moved the installation did you also change the settings in options? I replied over at godbit too but thought in case you checked here first… double check your url under the options tab in wp-admin and make sure that’s correct first. I forget that myself a lot and it drives me nuts. ??

    Forum: Plugins
    In reply to: Get Parent Pages

    You know, this might be easier, if all you want to do is use CSS to do this, much cleaner too. What I do is just add an id or class to the <body> tag and then style each page differently. That would mean instead of a physical header img (<img src...) you’d make it a background image with CSS.

    You can read more here… https://wp.nataliejost.com/dev/body-ids-classes/

    NOTE: You don’t actually need to make a plugin for this. It will work simply by adding the code anywhere on your page… <?php remove_filter('the_excerpt', 'wpautop'); ?>

    the_date() will show the date once for each day no matter how many posts are on that day.

    the_time() will show the date for each individual post.

    The latter is probably what you want.

    Thread Starter natalie

    (@natalie)

    Even better, Otto, thank you! So simple but I never would have thought of doing that.

    Thread Starter natalie

    (@natalie)

    I figured as much, thank you for confirming that for sure. I’m coming back to WP from Textpattern where I had a “color” category that people have linked to all over the web (and now is broken by my switch back to WP). For anyone looking for a solution to this, I’m going to make a page named “color”, assign it a custom template which will show all of the posts in the color category. Wouldn’t do it for all categories, but this one is more important.

    Thanks again!

    Thread Starter natalie

    (@natalie)

    Thanks, I’ll see if I can find something there. I’d like to do with without using the feed if possible though.

Viewing 15 replies - 1 through 15 (of 22 total)