Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • hi there
    i have recently used the default theme (kubrick) to make a small non blog site but modified it a fair bit so it doesn’t look very kubrick-ey
    one problem with this theme was that it used images for it’s backgrounds and questions i posted to this forum elicited some “don’t ask me about altering kubrick” kind of replies
    as for lots of php code, that’s not really an issue, you won’t be altering it just not using it
    so … check a few themes before starting work, because the deeper you get into it the more reluctant you’ll be to start over
    good luck!

    Forum: Plugins
    In reply to: regex question
    Thread Starter leeland

    (@leeland)

    thanks maerk
    here’s the pastebin link for the working header.php file
    https://pastebin.be/3024/

    Forum: Plugins
    In reply to: regex question
    Thread Starter leeland

    (@leeland)

    thanks maerk
    sorry for the lag, i’ve been away
    i can’t seem to get this preg_match to work at all
    not sure what the problem is and can’t spend anymore time on it
    sorry, i’m giving up and using an embarrassingly blunt list of possible ‘blues’ like this:


    if(is_page('blue')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-2')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-3')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-4')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-5')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-6')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-7')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-8')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-9')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-10')){echo "kubrickbgblue.jpg";} else
    if(is_page('blue-11')){echo "kubrickbgblue.jpg";} else

    i’m sure your stomach will turn when you see this
    i’m totally embarrassed and hang my head in shame
    o well
    thanks for the generous help anyway
    regards

    Forum: Plugins
    In reply to: regex question
    Thread Starter leeland

    (@leeland)

    you’re most patient maerk
    this looks good, i’ll give your suggestion a go
    it’s a pity, as i liked the way i could change the slug and not affect the page title, keeping the names of these pages more informative
    thanks again!

    Forum: Plugins
    In reply to: regex question
    Thread Starter leeland

    (@leeland)

    hey thanks for that maerk,

    yes i thought is_post was a string
    if it’s a boolean, how come
    if(is_page('blue-2')){echo "kubrickbgblue.jpg";} else
    if(is_page('yellow')){echo "kubrickbgyellow.jpg";} else

    works?

    i’ll check your link and keep on mulling

    Thread Starter leeland

    (@leeland)

    hi
    me again
    i have found a problem with the approach of using a post slug to identify which bg image to use in a page, namely that i can’t use the same slug twice. wordpress appends a hyphen and number, this kind of breaks the usefulness of this approach.

    any ideas to get around this?

    my thoughts are to have a wildcard in the code to ignore the hyphen and number, like

    ?>/images/<?php if(is_page('yellow'
    &&wildcardHere?)){echo 'kubrickbgYELLOW.jpg';} else

    or to go with the custom page template approach i outlined in a previous post (which i have no idea how to do)

    any thoughts anybody?
    thanks

    Thread Starter leeland

    (@leeland)

    hi again
    i see from the link you sent davedotcom that i can use the post slug as an identifier in the if(is_page("slug") and this seems to work just fine, i can have a bunch different page background colors, each asociated with a slug name, perfect.
    thanks for the pointer.
    i’m just wondering if using the slug this way could be a problem later on?

    Thread Starter leeland

    (@leeland)

    hi davedotcom
    thanks for that, putting in a specific page id number certainly does successfully change the background image for the specified page
    and i’ll start reading the conditional tags intro right now
    but…
    so the code would work with any number of pages, i’m wondering if rather than hard coding in every id number there’s a way of sending the header some other identifier associated with the assigned custom page template, which is the code for page.php with a template name added at the top.
    does this approach make sense?


    <?php
    /*
    Template Name: yellowtemplate
    */
    ?>
    //maybe here add a yellow identifier to send to the header?
    <?php get_header(); ?>
    <div id="content" class="narrowcolumn">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><?php the_title(); ?></h2>
    <div class="entry">
    <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
    </div>
    </div>
    <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

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