Forum Replies Created

Viewing 15 replies - 226 through 240 (of 261 total)
  • In your index.php, home.php, or a static page template (whatever you’re using for your homepage), in the template file you could just pull the post like this:

    <?php
    // Grab your post
    $your_post = get_post( 'post_ID_you_want' );
    
    // Display the title of the post
    echo $your_post->post_title;
    
    // Display the filtered content of the post
    echo $your_post->post_content_filtered;

    Reference: http://codex.ww.wp.xz.cn/Function_Reference/get_post

    haha awesome I’m glad this all helped. If you need more help on this in the future, you can reply to this thread again, but if I don’t see the email notification, you can contact me on Twitter, also.

    It is definitely possible to “paginate” the terms. It’s just not like it’s built into WordPress, exactly.

    You can always pass variables through the URL and retrieve them as PHP variables as your page loads.

    And since get_terms function has an “offset” argument you can pass in, this makes it possible to do this also…

    So in theory you could do something like this… You’d pull the first say, 20 series. Then you could put a link like to this at the bottom:

    http://yoursite.com/your_archive_page?my_page_var=2

    Then at the top of your archive page (above all the code we talked about previously) you’d have it setup something like this:

    <?php
    if( isset( $_POST['my_page_var'] ) ){
          // ... now make the offset argument relative to
          // my_page_var if it exists
          $offset = ( $_POST['my_page_var'] - 1 ) * 20;
    }

    In the example above, since my_page_var was 2 passed through the URL, now the offset would be (2-1)*20 = 20, if it had been three, it would be (3-1)*20 = 40, etc.

    Then, after your $args array, you’d do something like this:

    // add offset argument to array if it was set earlier.
    if( isset ( $offset ) )
       $args['offset'] = $offset;

    So, every time the page loads it’s looking for the my_page_var passed from the URL, and will offset the call to get_terms accordingly. You can see it’s all quite possible, but just starts to get hacky and messy.

    Oops, there was a typo in my pastebin code, here’s the revised:

    http://pastebin.com/Hr8Hmshj

    Also, in the foreach loop, I just copied what you had, but note that you can enclose all of your strings with single quotes opposed to having to escape all your inner double quotes with forward slashes.

    So instead of this:

    echo "<a href=\"http://google.com\">Google</a>";

    You can do this:

    echo '<a href="http://google.com">Google</a>';

    … which may make things a little more readable.

    Ya, see the problem was you were trying to pass all of these arguments in the get_terms function that don’t exist for that function. For future reference, this is the outline of all arguments you could potentially use in grabbing your terms with that function:

    http://codex.ww.wp.xz.cn/Function_Reference/get_terms
    (look under “Possible Arguments”)

    The first argument you can actually pass in is the number of terms to return, and since they’re ordered by ID, you’d want to keep them that way but change the order to DESC (which I think you already figured out).

    So, it would be something like this:

    http://pastebin.com/ji7uQUgY

    “Categories” are a taxonomy (just one that is already built-in to WP), so using them would essentially be the same as using your custom taxonomy “Series”. The fact is you can’t paginate a taxonomy’s terms, because when we’re talking about the WordPress loop, that only applies to displaying posts.

    1) You could just make “Series” your custom post type, and not have a taxonomy at all. Then for each Series post page, you could have all the videos for that series on that post. This might actually be kind of logical, because if your series only have a few sermons in each, then it would make sense that a user might want to be able to easily watch all the sermons in the same place.

    2) I personally like this idea better than #1. Keep everything the way you have it with the Series as a taxonomy of Sermons post type.

    You could just list the most recent five series on your main page where it shows the big image for each one, and then at the bottom, have a link that says something like “Series Archive” … and then when they click that, it takes them to a page where maybe it lists all series in some sort of nice format with smaller image next to each one.

    For a series archive page, I’m imagining something sort of like how WordPress.tv lists out the video archives (except in your case we’re talking about series, not individual videos):

    http://wordpress.tv/flavor/wordpressorg/

    Ohhh, sorry I see now. Each one of those blocks with an image is one of the series, and you want to paginate those as if they were posts.

    I think there’s kind of weird thing you got going on there because you’re essentially displaying taxonomy terms as if they’re posts (in the traditional sense of how we display posts anyway in a WP theme).

    I don’t think there’s a way to actually paginate your series the way you have it. You could do it with javascript though pretty easily. When you use get_terms, and you’re then looping through them, you could separate them out with a div or somethign every 5 series or whatever… then have some sort of javascript slider, where you click a “next” link at the top or bottom and the whole thing slides to the next 5. Something like that maybe?

    Okay so where on the page are you wanting the “pagination” effect?

    I see at the top you have “Recent Series”… is your main goal just to keep that list of piling up as you add more series? So, are you trying to break that list up into segments? Are you wanting each of those series names to link to the actual series it corresponds to? And since you have been talking about the concept of “pagination”, I assume you’re imagining some numbered links that appear where? At the bottom of the list maybe?

    You have your site in maintenance mode. Can you take it off so I can see? Then, maybe I’ll have a better idea of what you’re trying to visually accomplish. I think there might be a better approach to what you’re trying to other than the concept of pagination, but I’m still not following 100%…. well there will have to a better way because I don’t think what you’re describing is pagination 🙂

    I think you’re sort of getting confused on the concept of pagination. As far as I know, when you’re dealing with pagination, it wouldn’t really make sense to do that by taxonomy term.

    When the WordPress loop runs, you’re pulling posts, right? Then, you have all of these arguments you can pass in (i.e. like tax_query) that will help to filter the posts you end up with, or when you go to certain archive pages, WordPress automatically knows to filter the posts to that archived thing. Then, when you paginate them, you’re just splitting up those posts at a certain number interval to “paginate” them.

    Sorry if I’m not understanding exactly what you’re wanting… So, what you’re wanting to do is have some sort of menu that lists out your terms at the bottom of the page, and then when you click a term, you go to a page that shows all of the posts that are specific to that term?

    All you would do is create a list of terms where each one links to its respective term archive. If you put this menu/list at the bottom of page, that is sort of what you would end up with – a “paginated” by term effect.

    You can see an example of how to create a term list with links to each archive in the last example here:

    http://codex.ww.wp.xz.cn/Function_Reference/get_terms#Examples

    From my understanding, the tax_query is an argument that you can feed in when filtering your posts, so I don’t believe it would make much sense to use it in an attempt to print out the terms for a taxonomy.

    You could just do something like this using get_terms to show a list of all your taxonomy terms if at least one exists:

    <?php
    $terms = get_terms("my_taxonomy");
    $count = count($terms);
    if ( $count > 0 ){
    	echo "<ul>";
    	foreach ( $terms as $term ) {
    	echo "<li>" . $term->name . "</li>";
    
    	}
    	echo "</ul>";
    }

    Awesome, no problem 🙂

    Forum: Themes and Templates
    In reply to: Custom Fields

    Sorry, just a note in what I said… I got confused when you referred to it as a “page”, but I think you actually meant a “post” … So where I say “page.php” above, I meant “single.php”

    Awesome, I’m glad you were able to figure out how to make your first theme. That’s always really cool to see.

Viewing 15 replies - 226 through 240 (of 261 total)