ipaulpro
Forum Replies Created
-
::clears throat:: (echo)
Forum: Fixing WordPress
In reply to: Fatal Error: Call to undefined function get_shortcode_regex()brendadada –
What ftp program are you using? Sometimes errors in the FTP upload process will cause these types of errors. Re-upload all of the 2.5.1 files BESIDES ‘wp-content’ and ‘wp-config.php’. If you are still having this problem, use a different FTP program.
I just had the same issue. After a restart of the FTP program and overwrite of the files (minus above), everything works fine.
Let me know how it goes.
Forum: Requests and Feedback
In reply to: Show only sub-categoriesForgot, you wanted the same to work for subcategory pages. The code should be this:
<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
Forum: Requests and Feedback
In reply to: Show only sub-categoriesYou want pretty links, refer to this article to set up your custom Permalink structure.
You could make a Page called “Songs” and try this:
<ul> <?php wp_list_categories('orderby=id&show_count=1 &use_desc_for_title=0&child_of=8'); ?> </ul>
Enter the parent-category ID where the ‘8’ is. Refer to this article for more details on “wp_list_categories”.
And in general, get familiar with Template Tags. <– The key to WordPress. From this page you will find documentation on:
- Stepping Into Template Tags (an introduction to Template Tags)
- Anatomy of a Template Tag (details of how to put Tags into Template files)
- How to Pass Tag Parameters (details of how to use Parameters with Tags)
- Include Tags (additional tags not shown here, related to including one Template file within another)
- Conditional Tags (more additional tags not shown here, related to making your Templates more flexible with options)
- Templates (a comprehensive list of Template, Theme, and Tag resources)
- Stepping Into Templates (introduction to Template files)
Good luck, let me know how this goes I’ll keep watch on this post. Welcome to the WordPress community.
Forum: Fixing WordPress
In reply to: subcategory dynamically matching parent category templatesHey, SocialChris, come across a solution for this yet?
Anyone out there?
Pass Category Template to sub-categories without making each individual category-*.php page?
Forum: Fixing WordPress
In reply to: How to Embed YouTube Thumbnails?Sorry I’m new to giving advice. If you want code to copy and paste for the loop, here it is (without my site-specific code)
<?php if (have_posts()) : ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('showposts=6' . '&paged=' . $paged . '&cat=4'); $wp_query->is_archive = true; $wp_query->is_home = false; ?> <?php while (have_posts()) : the_post(); ?> <div class="thumbnails" id="post-<?php the_ID(); ?>-thumb"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="https://s2.ytimg.com/vi/<?php // this is where the custom field prints images for each Feature $values = get_post_custom_values("video_id"); echo $values[0]; ?>/default.jpg" alt="<?php the_title(); ?> Thumbnail" /></a> <p class="thumb_title"><a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_title(); ?></a> <?php endwhile; ?> <div class="navigation"> <div class="alignright"><?php next_posts_link('Next') ?></div> <div class="alignleft"><?php previous_posts_link('Previous') ?></div> </div> </div> <?php endif; ?>
CSS that needs styling with this code:
- .thumbnails
- .thumb_title
- .navigation
- .alignright
- .alignleft
Forum: Fixing WordPress
In reply to: How to Embed YouTube Thumbnails?Revised to allow pagination:
<?php if (have_posts()) : ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('showposts=6' . '&paged=' . $paged . '&cat=4'); $wp_query->is_archive = true; $wp_query->is_home = false; ?> <?php while (have_posts()) : the_post(); ?> <div class="thumbnails"> <p class="title" id="post-<?php the_ID(); ?>-thumb"><a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_title(); ?></a> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="https://s2.ytimg.com/vi/<?php // this is where the custom field prints images for each Feature $values = get_post_custom_values("video_id"); echo $values[0]; ?>/default.jpg" alt="<?php the_title(); ?> Thumbnail" /></a> <?php the_category(' ') ?> <small><?php if(function_exists('the_ratings')) { the_ratings(); } ?></small> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignright"><?php next_posts_link('Next') ?></div> <div class="alignleft"><?php previous_posts_link('Previous') ?></div> </div> </div> <?php endif; ?>
Forum: Fixing WordPress
In reply to: How to Embed YouTube Thumbnails?Posts as Youtube Thumbnails
You can use the custom fields to accomplish this.
First, create a custom field in one of your posts. Name the ‘Key’ somethings like ‘video_id’ (without quotes) and in the ‘Value’ field, put the ID of the youtube video:
So if your embed code looks like this:
<object width="425" height="355"><param name="movie" value="https://www.youtube.com/v/uug6TjvRJaE&hl=en"></param><param name="wmode" value="transparent"></param><embed src="https://www.youtube.com/v/uug6TjvRJaE&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
the Custom Field would be Key=video_id and Value= uug6TjvRJaE
After creating the custom field, create a new page template (eg. video_thumbs.php) NOTE: you can alter your index.php file directly, but I would advise testing on a page first.
In that new page, copy and paste all of the contents of your index.php. Then replace the loop with this code:
<?php if (have_posts()) : ?> <?php // this is where the module begins query_posts('showposts=1&cat=199'); ?> //change the showposts number to the number of posts that you want to appear, and change cat=199 to your category number (or remove), which you can find out by going to Manage > Categories <?php while (have_posts()) : the_post(); ?> <div class="thumbnails"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="https://s2.ytimg.com/vi/<?php // this is where the custom field prints images for each post $values = get_post_custom_values("video_id"); echo $values[0]; ?>/default.jpg" alt="<?php the_title(); ?> Thumbnail" /></a> <p class="title"><a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_title(); ?></a> </div> <?php endwhile; ?>
Only replace the code between
<?php if (have_posts()) : ?>
and<?php endwhile; ?>
Save and upload to your server. Then create a new page and set it to use the video_thumbs.php template. Navigate to this page and viola!
You must add a ‘video_id’ custom field to any post that you wish to have a thumbnail.
With the example above each entry will be given a div class of ‘thumbnails’. You can call that whatever you want, as well as style it appropriately.
Of course, when you have your desired results you could use ‘is_home’ conditional tags to incorporate this into your index.php file.
This works for me. Just figured this out for myself and I was so happy that I had to share. I knew people would love to hear my solution.
And just so you know, the link to a thumbnail for any youtube video is https://s2.ytimg.com/vi/VIDEO_ID/default.jpg (where ‘video_id’ is the youtube id – eg: https://s2.ytimg.com/vi/uug6TjvRJaE/default.jpg)
Let me know how it goes. May end up turning this into a simple plugin.
Use the CSS selector
current_page_ancestor
eg:
li.current_page_item, li.current_page_parent, li.current_page_ancestor { font-weight: bold; }