Forum Replies Created

Viewing 14 replies - 31 through 44 (of 44 total)
  • Ok. Let’s start by assuming you have a category called “books” (category id is, say, 15).

    If you create a category.php template file in your theme, your website will access category.php when someone views the “books” category. You can then edit the category.php file to change the display to whatever you want.

    Take our site, for example. We have a category called “tutorials” here: https://www.newnine.com/tutorials. The design of our tutorials category is in category.php, which differs from the design in single.php (the template file for a single post). That’s why the designs look slightly different between our tutorials category and an individual post (like this one: https://www.newnine.com/tutorials/29-remove-category-from-urls-in-wordpress).

    We didn’t create any special redirects or anything. We simply copied the index.php file, renamed it to category.php, and WordPress took care of the rest — sending all “tutorial category” requests to the new category file.

    Now…if you want to get even more specific (maybe a different design for each category), you can create category-xxx.php for the “xxx” category, category-yyy.php for the “yyy” category, and so on.

    See the WordPress template heirarchy: https://codex.www.ads-software.com/images/1/18/Template_Hierarchy.png

    For the books category, WordPress would first look for a category-books.php file. If none exists, it would look for the category-15.php. If that doesn’t exist, it will look for category.php. No category.php? It will look for archive.php, and then finally settle on index.php.

    You can create redirects to do other things, but for a category page, the functionality is all there with no extra redirect coding. Just create the file and design away.

    A quick aside: Do you know about category-xxxxxx.php? This would, by default, display only posts from the xxxxxx category and you don’t need to create any redirects, rewrites, or includes.

    Don’t know your level of experience with WordPress so I thought I’d throw this in. ??

    It looks like it’s working in general. The problem is the apostrophe in your title which is converting to a URL-safe character. All you need to do is to edit the post’s “slug”. In your dashboard, go to the post, edit the slug (just below the title — if it’s not there, click Screen Options on the top right of the screen and check the “slug” box), and delete from your slug:

    %e2%80%99

    By doing so, your article’s new URL will be:

    https://www.financetwitter.com/2010/07/10-facts-about-apples-latest-earnings/

    Fixed!

    Do this for any post having this problem. In the future, when writing articles, WordPress will strip this be default when creating your URL slug.

    Sign up for Feedburner and then activate e-mail subscriptions. Feedburner will convert your feed into e-mails and send them out.

    I just tried both links in Firefox and Internet Explorer and it looks as though everything is fine. Did you get this resolved?

    These links are in a div with the comment-remix-meta class. You can change their color with (enter your own color):

    div.comment-remix-meta a {color: #0000ff;}

    The date/time permalink of the comment is in a paragraph with the comment-meta class, so you can change that with:

    p.comment-meta a {color: #0000ff;}

    Samuel B had the right fix. You can’t open a <?php tag inside of an already open <?php tag. That’s why he removed it from Line 36. Now, we need to find that other error. What exactly was the PHP error you saw?

    For new posts: You can set comments closed as the default by going to Settings->Discussion and uncheck Allow people to post comments on new articles.

    For existing posts: If you have access to your MySQL database, you can run this SQL code on the wp_posts table to change all posts to “closed” for new comments. (If you changed the prefix of the tables in your config file, look for the prefix_posts table.)

    UPDATE wp_posts SET comment_status='closed'

    Should have also clarified that you need to replace all of the

    the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) );
    and
    the_excerpt();

    with

    the_content();

    The code I gave you works. I’m using it right now. But you need to make sure that you also don’t tell WordPress to display a “more” link or an excerpt which is why you need to make the above changes.

    If you’re using a child theme, you’ll need to edit that loop.php or category.php.

    You can already do this. When you go to Appearance->Menus, you should see a field called CSS Classes (optional) with each link. If you don’t see this option, click Screen Options (top right of your dashboard) and select CSS Classes from the Show advanced menu properties section.

    Then, simply add a class to the first (or last or whatever) link and remove the bar, padding, etc.

    Single.php will show the entire post by default. If you want people to view the most recent 10 (or 30 or whatever default setting you have) posts — in full — when they click on the category, you need to edit category.php. If you’re sticking with the default Twenty Ten theme, you need to edit loop.php instead.

    Look for this line (on line 56):

    <?php while ( have_posts() ) : the_post(); ?>

    Just below it, add the “more” code I gave you so your loop.php looks like this:

    <?php while ( have_posts() ) : the_post(); ?>
    <?php global $more; $more=1; ?>

    If everything should be in Century Gothic, change your body CSS to:

    body {
      line-height: 1;
      color: black;
      background: white;
      font-family: "Century Gothic";
      font-size: 11pt;
    }

    and then also add the following line to your CSS file:
    .post p {font-family: "Century Gothic"; font-size: 11pt;}
    Then, don’t worry that it is in times new roman (or whatever) when you’re typing your posts. When it displays on your page, it will display with the font type and size you specified in the CSS file.

    Changing the page name would also change the browser title, assuming you have <title><?php the_title();?></title> in the head of your document.

    If you only want to change this one title on this one page, check to see if that page is called and swap the title:

    Assuming the page id in question is 72
    <?php if($post->ID==72):?>
    <h2>My New Title</h2>
    <?php else: the_title();?>

    If this is something you want to do on all of your pages, you can start your page with a Heading tag with your custom page text and remove <h2><?php the_title();?></h2> from your theme?

    So your (highly truncated) code would look like this:

    ...
    <title><?php the_title();?></title>
    ...
    <?php if(have_posts()):while(have_posts()):the_post();?>
      <div class="entry"><?php the_content();?></div>
    <?php endwhile; endif;?>

    By default, WordPress shows the excerpt (or portion) of a post on archive, category, tag and other “group” pages. You can change this easily by adding:

    <?php global $more; $more=1; ?>

    So…your code might look like this:

    <?php if(have_posts()) : while (have_posts()) : the_post();?>
      <?php global $more; $more=1; ?>
        <div class="entry">
          <h2><?php the_title();?></h2>
          <?php the_content();?>
        </div>
    <?php endwhile; endif;?>
Viewing 14 replies - 31 through 44 (of 44 total)