Support » Plugins » Expand specific posts on index, but not others

  • Resolved dainismichel



    Is there a way to expand specific posts on the index page, but not others? The checkbox would be something like “show expanded on index page,” and of course, the HTML would remain in tact.



Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi

    A good way to do that would be to use a custom field on the posts you want expanded.

    Create a custom field called for example ExpandOnIndex and set it to true on all posts you want expanded on the index page.

    in index.php change your loop code. This is the coding from the default theme – most themes will be similar

    <div class="entry">
         <?php the_content('Read the rest of this entry &raquo;'); ?>

    using my example, change it to this

    <div class="entry">
      $expand = get_post_meta($post->ID, 'ExpandOnIndex', true);
      if ($expand) {
         the_content('Read the rest of this entry &raquo;');
      } else {

    The first part of this article is a tutorial on how to create a custom field, if you aren’t familiar with that.

    Gosh, that works perfectly, I wish I understood the code better. Could someone translate the code into “English” so I can learn better?

    what does $ mean? Does that mean I am defining a variable?
    I think get_post_meta is likely a “function,” but what does that mean?

    What a kind reply, I mean just posting the code like that. Thank you.



    PHP variables begin with a $

    To understand get_post_meta review:

    OK, that takes care of one php “code translation,” and it points me in the right direction regarding what I “think” are called “wordpress functions.” Thanks a ton!

    Now, coming from a linguistic perspective, how can I begin to “translate”

    <div class=”entry”>
    $expand = get_post_meta($post->ID, ‘ExpandOnIndex’, true);

    into English, so that I can begin to “think” PHP code in English and then write it in PHP?

    <div class=”entry”> =
    div (I don’t know)
    class is a type of CSS style
    = is
    within quotes the name of the style

    open carat = ?
    ? = I’m guessing here…uh…start code
    php = the type of code to start

    $expand = get_post_meta($post->ID, ‘ExpandOnIndex’, true);

    $ = begins PHP variables
    $expand = begin the variable called expand
    $expand = = defining the variable called expand

    get_post_meta($post->ID, ‘ExpandOnIndex’, true);
    the wordpress function, which I can set to particular parameters as outlined in the WordPress codex.

    OK, so, with what I did, can you guide me to a “linguistic translation” of PHP, or to a resource that explains coding in that manner?


    Probably better that I direct you to some other sources:

    Thanks Michael,

    Gotta love it!



    Using a new theme and wanting to figure this out for

    <?php the_content_limit(410, “”); ?>

    …I’ll try some stuff out…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Expand specific posts on index, but not others’ is closed to new replies.