Forum Replies Created

Viewing 15 replies - 46 through 60 (of 546 total)
  • Yeah, I guess that is true, though mostly they seem to simply edit the title or content… I suppose both have their advantages and disadvantages.

    It’s good to know what both are, that’s for sure.

    My clients are less likely to delete a page than completely change its content, but that’s me. I also create a role that doesn’t allow them to do that — but rather I show them how to set a page to draft status to keep it out of a menu, etc.

    Are you wanting to do this on one particular page? Or your homepage only? Per what Esmi said, you probably can’t do what you are describing with an exclude parameter… which isn’t really for a custom query anyway.

    YOu’d likely have to build a custom query of the category you want your posts from and use showposts= whatever value yo want (6)

    as in this example, which is a SECOND LOOP after the ending the first (defaul) lopp with just the endwhile; statement:

    <?php $my_query = new WP_Query('cat=14&showposts=6'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <?php the_excerpt(); ?>
    <p >Read the rest of "<?php the_title(); ?>" in <?php the_category(' &raquo; '); ?></p>
    <p class="postmetadata"><?php edit_post_link('Admin Edit', '', ''); ?></p>
    <?php endwhile; ?>

    and after all the loops, add in ending endif; statement

    You must be talking about how many pages are LISTED in the list of all the pages you have.

    How this is managed depends upon the version of WordPress you are using. If you are using 2.8.5, there is a list of links at the top that include All | Published | Drafts, etc

    Earlier than 2.8.5, one version was really messed up and didn’t have the option to set the number and it defaulted to 15. You had to use a plugin to modify that.

    Earlier… I forget how it was managed. It’s a great reason to update your version.

    However, it IS the edit-pages.php file in the wp-admin directory that controls this… but it isn’t really a great idea to modify core files. Better to use the admin settings or a plugin.

    Glad to have helped. I use WordPress as a CMS for about 95% of what I do… in the years I’ve been using it, I have realized that there is often more than one way to get the job done.

    Note that by using Pages, you can easily point to Page templates… so you can easily customize what displays on various sections of your site by altering the page.php file to be something like page-home.php or page-products.php etc if you need an even wider variation of conditionals.

    As well, you can add the (is_tree()) function to your functions.php file and you can conditionally add programming or markup for a template used by ALL of the sub-pages (immediate children… doesn’t apply to “grand-child” pages) to avoid having to write arrays or tons of (is_page()) statements.

    Do a search for (is_tree()) in the documentation to find out how to do that.

    Here’s to a great week!

    IE6 handles multiple classes just fine.

    I’d minimize your code to write the else/if stuff solely for the class to add…

    eg:

    <div id="wrap" class="<php
    if (is_front_page())  {
     echo 'bg-home';}
    elseif (is_page('licensing'))  {
     echo 'bg-licensing';}
    elseif (is_page('about'))  {
    echo'bg-about';}
    elseif (is_page('news'))  {
    echo'bg-news';}
    elseif (is_page('artist-writer'))  {
    echo'bg-artist';}
    elseif (is_page('store'))  {
    echo'bg-store';}
    elseif (is_page('contact'))  {
    echo'bg-contact';}
    else {echo 'bg-home';} ?>;">

    since the div and the id=wrap and class=” are all shared across every instance you indicate in your elseif statements.

    I’d look to see if the id was somehow counteracting the class rules you are specifying. Make those rules more important or give them greater specificity OR define their differences in your header.php file in <style> </style> rules that define the changing property value(s) conditionally.

    BTW, I tend to stick with ids for the if (is_page()) function… the title or slug can change, but the id doesn’t.

    just a suggestion. HTH.

    BTW, it *can* have associated custom fields… (your homepage) if you create it as a Page.

    Page templates can display one or more categories of posts…it can also have multiple loops. There’s nothing different about page.php or index.php… the defaults simply include programming to access the most commonly used elements, like “comments” in your index.php file because comments are associated with posts.

    But you can edit either or both or create custom files to use.

    For example, make you home content a Page (home) and add the intro text there or use whatever custom fields you need. Then, to get that content, use the standard loop.

    To get your category content, add a custom query with categories desired and use another loop, eg:

    <?php $my_query = new WP_Query('cat=14&showposts=1'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <?php the_excerpt(); ?>
    <p>Read the rest of "<?php the_title(); ?>" in <?php the_category(' &raquo; '); ?></p>
    <p class="postmetadata"><?php edit_post_link('Admin Edit', '', ''); ?></p>
    <?php endwhile; ?>

    The key to this method is

    A) the main content loop comes first — but doesn’t not finish the loop with the standard <?php endwhile; endif; ?> — just the endwhile; statement.

    Note that the custom query also uses an endwhile; statement.

    B) after you finish all loops, close out with the endif; statement.

    C) then point your homepage setting to the static home “Page”

    D) the custom query can use more than one category; just list them separated by commas, per the usual and indicate the number of posts to display, etc.

    HTH

    If you are specifically meaning for a homepage — then you could use:

    if (is_front_page()) {
    echo 'wahtever you want here'; }
    else {}

    I use that all the time. It is not required that your “front page” use a page.php or index.php template file… put it in both places if you are unsure which is being used… otherwise, if you are specifying your home page to be one showing your categories, then put it into the index.php file

    HTH

    D. Casey

    Thread Starter syncbox

    (@syncbox)

    OK. finally got this working, though not sure why or how…

    What I did was to put the template FILE name in instead of the “name” of the template… not sure if that was the issue but it’s working now, so I will change my status for the plugin.

    You might consider an example (if indeed having the file name of the template is that critical) to indicate that you mean the actual .php file name

    Thread Starter syncbox

    (@syncbox)

    Additional notes about broken behavior…

    1) I reinstalled just to ensure that wasn’t the issue.
    2) I went into the settings and disabled all the templates and saved/updated
    3) went to the pages list and located the page that SHOULD display this template. In the quick edit, the menu for CFT templates DID offer Template#1 (by name) even though it was set to DISABLED in the settings!
    4) selected it and clicked the load button in Quick Edit
    5) updated
    6) Clicked the Edit link to view the content of this page and NO TEMPLATE!. Also, the CFT menu only offered the DEFAULT template!
    7) went back to CFT Settings and unchecked the diabled option for Template #1 and updated.
    8) went back to the page in question and NO TEMPLATE (except default)

    What’s up with this? I like the new options but will have to go back to the older version at this point… note, there were no specific or special instructions for upgrading versus installing… my plugins page notified me that there was a newer version of the plugin and I used the auto-update functionality to upgrade.

    Seems like this would be a great idea for a plugin — that would allow you to wrap child lists with your choice of markup… I’m not a php programmer or plugin writer, but… I can’t tell you how many times I wished I had this functionality so that I don’t have to “settle” for ho-hum menus…

    I’d even donate generously to someone who created it!

    Yes, I agree wholeheartedly. I’d like the option to wrap a div around the nested list generated for child pages… so that I can tap into some of my favorite javascript menu scripts —

    Anyone out there who can tell me how to modify start_el to output a div around the nested ul? only at the child level?

    <ul>
    <li><a href="#">parent #1</a>
    <div>
    <ul>
    <li><a href="#">child 1-a</a></li>
    <li><a href="#">child 1-b</a></li>
    <li><a href="#">child 1-c</a></li>
    <li><a href="#">child 1-d</a></li>
    <li><a href="#">child 1-e</a></li>
    </ul>
    </div>
    </li>
    <li><a href="#">parent #2</a>
    <div>
    <ul>
    <li><a href="#">child 2-a</a></li>
    <li><a href="#">child 2-b</a></li>
    <li><a href="#">child 2-c</a></li>
    <li><a href="#">child 2-d</a></li>
    </ul>
    </div>
    </li>
    <li><a href="#">parent #31</a>
    <div>
    <ul>
    <li><a href="#">child 3-a</a></li>
    <li><a href="#">child 3-b</a></li>
    <li><a href="#">child 3-c</a></li>
    </ul>
    </div>
    </li>
    </ul>

    ??

    Yes, I agree wholeheartedly. I’d like the option to wrap a div around the nested list generated for child pages… so that I can tap into some of my favorite javascript menu scripts —

    Anyone out there who can tell me how to modify start_el to output a div around the nested ul? only at the child level?

    </div>

    </div>

    </div>

    ??

    Thread Starter syncbox

    (@syncbox)

    Doh! sort_column=menu_order…. DOH!

    Thread Starter syncbox

    (@syncbox)

    Nevermind, found my own answer (again).

    It’s in the “get_the_title() functions in the post-template.php file in wp-includes, line 113 in version 2.8.5

    $protected_title_format = apply_filters(‘protected_title_format’, __(‘Protected: %s’));

    Oh, sorry, I didn’t realize what you were wanting to do I guess… I have to agree with the others if all you want to do is keep your site window open.

    I assumed you simply didn’t want an external link to replace YOUR site.

Viewing 15 replies - 46 through 60 (of 546 total)