Jeremy Herve
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Decrypt Footer Please!If I may, do yourself a favor, and do not use any theme including encrypted code.
See this article for more details, or try using the tools Otto mentions in this post if you really want to use such a theme.
Forum: Fixing WordPress
In reply to: Display caption with the_post_thumbnailIt does not seem to work I am afraid.
There is no output of the function in the code.
I placed it in the loop, right after calling the_post_thumbnail, but no caption appeared.
<?php the_post_thumbnail('single-post-thumbnail'); ?> <?php $thumb_id = get_post_thumbnail_id($post->id); $args = array( 'p' => $thumb_id, 'post_type' => 'attachment' ); $thumb_image = get_posts($args); $thumb_caption = $thumb_image->post_excerpt; ?> <?php the_content(); ?>Any idea why?
Thank you!
Forum: Fixing WordPress
In reply to: Display caption with the_post_thumbnailI will give it a try then, and come back here to tell you if it worked!
Should I open a ticket in the trac to propose such feature? What do you think?
Thank you!
Forum: Fixing WordPress
In reply to: wordpress login screen image change issueI am not sure I fully understand what you meant to do: the important part, the one you can modify is:
'.get_bloginfo('template_directory').'/images/login-logo.png
This links to the /images/ folder inside your theme folder. You can simply move your logo there, and name it login-logo.png, or change only that part of the code to the one you need.If you want to link to an external image, you need to provide the full url (with http://…) and thus replace all the template directory call
Does that work for you?
Forum: Fixing WordPress
In reply to: wordpress login screen image change issueLook for such code:
function my_custom_login_logo() { echo '<style type="text/css"> h1 a { background-image:url('.get_bloginfo('template_directory').'/images/login-logo.png) !important; } </style>'; } add_action('login_head', 'my_custom_login_logo');That’s the correct code to change the login page logo.
Forum: Fixing WordPress
In reply to: Integrate latest tweets without pluginAlright, I gave up with the API, I am pulling the tweets from the feed now, it works fine:
$username = "jeherve"; // Your twitter username. $limit = "3"; // Number of tweets to pull in. /* These prefixes and suffixes will display before and after the entire block of tweets. */ $prefix = ""; // Prefix - some text you want displayed before all your tweets. $suffix = ""; // Suffix - some text you want displayed after all your tweets. $tweetprefix = ""; // Tweet Prefix - some text you want displayed before each tweet. $tweetsuffix = "<br />"; // Tweet Suffix - some text you want displayed after each tweet. $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit; function parse_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) { $feed = str_replace("<", "<", $feed); $feed = str_replace(">", ">", $feed); $clean = explode("<content type=\"html\">", $feed); $amount = count($clean) - 1; echo $prefix; for ($i = 1; $i <= $amount; $i++) { $cleaner = explode("</content>", $clean[$i]); echo $tweetprefix; echo $cleaner[0]; echo $tweetsuffix; } echo $suffix; } $twitterFeed = file_get_contents($feed); parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);Thanks to Instantshift: http://www.instantshift.com/2009/05/25/10-twitter-hacks-for-your-wordpress-blog/
Forum: Fixing WordPress
In reply to: Social bookmarking buttons to add from the theme admin pageOK, that’s where I stand after a bit more research:
In single.php:
<? if ($mytheme_facebook_enable == "false") { ?> <? } else { ?> <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" title="Share on Facebook."> <img src="<?php bloginfo('template_directory'); ?>/images/facebook.png" alt="Share on Facebook" id="sharethis-last" /> </a> <? } ?> <? if ($mytheme_twitter_enable == "false") { ?> <? } else { ?> <a href="http://twitter.com/home/?status=<?php the_title(); ?> : <?php the_permalink(); ?>" title="Tweet this!"> <img src="<?php bloginfo('template_directory'); ?>/images/twitter.png" alt="Tweet this!" /> </a> <? } ?> <? if ($mytheme_delicious_enable == "false") { ?> <? } else { ?> <a href="http://del.icio.us/post?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" title="Bookmark on Delicious."> <img src="<?php bloginfo('template_directory'); ?>/images/delicious.png" alt="Bookmark on Delicious" /> </a> <? } ?> <? if ($mytheme_stumbleupon_enable == "false") { ?> <? } else { ?> <a href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>" title="StumbleUpon."> <img src="<?php bloginfo('template_directory'); ?>/images/stumbleupon.png" alt="StumbleUpon" /> </a> <? } ?>Then in functions.php I added these functions:
<?php $themename = "My Theme"; $shortname = "mytheme"; $options = array ( array( "name" => "Theme settings", "type" => "title"), array( "type" => "open"), array( "name" => "Enable Facebook", "desc" => "Check Box to enable (Share section)", "id" => $shortname."_facebook_enable", "type" => "checkbox", "std" => "false"), array( "name" => "Enable Twitter", "desc" => "Check Box to enable (Share section)", "id" => $shortname."_twitter_enable", "type" => "checkbox", "std" => "false"), array( "name" => "Enable Delicious", "desc" => "Check Box to enable (Share section)", "id" => $shortname."_delicious_enable", "type" => "checkbox", "std" => "false"), array( "name" => "Enable Stumbleupon", "desc" => "Check Box to enable (Share section)", "id" => $shortname."_stumbleupon_enable", "type" => "checkbox", "std" => "false"), array( "type" => "close") ); function mytheme_add_admin() { global $themename, $shortname, $options; if ( $_GET['page'] == basename(__FILE__) ) { if ( 'save' == $_REQUEST['action'] ) { foreach ($options as $value) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } foreach ($options as $value) { if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } } header("Location: themes.php?page=functions.php&saved=true"); die; } else if( 'reset' == $_REQUEST['action'] ) { foreach ($options as $value) { delete_option( $value['id'] ); } header("Location: themes.php?page=functions.php&reset=true"); die; } } add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin'); } function mytheme_admin() { global $themename, $shortname, $options; if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>'; if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>'; ?> <div class="wrap"> <h2><?php echo $themename; ?> settings</h2> <form method="post"> <?php foreach ($options as $value) { switch ( $value['type'] ) { case "open": ?> <table width="100%" border="0" style="padding:10px;"> <?php break; case "close": ?> </table><br /> <?php break; case "title": ?> <table width="100%" border="0" style="padding:5px 10px;"><tr> <td colspan="2"><h3><?php echo $value['name']; ?></h3></td> </tr> <?php break; case "checkbox": ?> <tr> <td width="20%" rowspan="2" valign="middle"><strong><?php echo $value['name']; ?></strong></td> <td width="80%"><? if(get_settings($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = ""; } ?> <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> /> </td> </tr> <tr> <td><small><?php echo $value['desc']; ?></small></td> </tr><tr><td colspan="2" style="margin-bottom:5px;border-bottom:1px dotted #000000;"> </td></tr> <?php break; } } ?> <!--</table>--> <p class="submit"> <input name="save" type="submit" value="Save changes" /> <input type="hidden" name="action" value="save" /> </p> </form> <form method="post"> <p class="submit"> <input name="reset" type="submit" value="Reset" /> <input type="hidden" name="action" value="reset" /> </p> </form> <?php } // End custom theme admin page add_action('admin_menu', 'mytheme_add_admin'); ?>Now all my bookmarks are displayed, even if only one checkbox is checked.
Any idea why?Forum: Fixing WordPress
In reply to: Localize theme without localizing BackendThanks Nao!
However I am afraid this is not exactly what I am looking for. I want to be able to change the frontend, but not the backend. This plugin does the contrary.
Does anybody know if it is possible?
Forum: Requests and Feedback
In reply to: New Default WordPress Theme?I am going to repeat what others said before me, but this 2010 theme should definitely serve as an example. It should consequently group lots of features that make WordPress great, while staying simple to start with if you are discovering WordPress and know nothing about code.
I think page templates are a great way to do just that. They can be there, serve as an example, and still stay at the back for the one who downloaded WordPress and who does not want anything but a blog.
Your idea of a homepage template with featured area is exactly what I would imagine.
I always say that the weakest point in the WordPress project is its past, and its background: everbody who knows a bit about WordPress will tell you it is a blog platform, but only a few of them know that it can be so much more. In my opinion, the default theme should be built with that “weakness” in mind.So I’d see a minimalist great-looking theme, well commented and extremely well documented, without too many images but a nice work on the typography, with a simple options page with only a few theme options, to serve as an example.
For additional features, if the theme is well documented, lots of child themes will be released in no time anyway.
Forum: Fixing WordPress
In reply to: wp-list-page to list only subpages of one particular pageI keep looking around, and this code seems to be like the beginning of something… will try to understand it, but if somebody could help, I’d be gratful! π
<?php $output = wp_list_pages('echo=0&depth=1&title_li=<h2>Top Level Pages </h2>' ); if (is_page( )) { $page = $post->ID; if ($post->post_parent) { $page = $post->post_parent; } $children=wp_list_pages( 'echo=0&child_of=' . $page . '&title_li=' ); if ($children) { $output = wp_list_pages ('echo=0&child_of=' . $page . '&title_li=<h2>Child Pages</h2>'); } } echo $output; ?>Forum: Fixing WordPress
In reply to: Add list of posts to page sidebar belonging to special category nameOK, I have tried both, I think I will choose Michael’s solution, like that I won’t have to add ines of code when my client wants to create a new page and a new category.
Just for info Michal, your code misses a , at the end of line 3. I was wondering what was not ok after I tried your code and realized that. Code with the additional , would be like so:
<?php $args=array( 'category_name' => $post->post_name, 'showposts'=>5, 'caller_get_posts'=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { echo '5 recent category Posts '; while ($my_query->have_posts()) : $my_query->the_post(); ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php endwhile; } //if ($my_query) wp_reset_query(); // Restore global post data stomped by the_post(). ?>Thank you again for your help!!
Forum: Fixing WordPress
In reply to: Add list of posts to page sidebar belonging to special category nameThanks to both of you!
I will have a look to both solutions, and come back to tell you which one is better for me! π
Forum: Fixing WordPress
In reply to: Add list of posts to page sidebar belonging to special category nameI figure the beginning should be like so:
<ul> <?php query_posts( 'category_name=XXXX&showposts=5' ); while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li> <?php endwhile;?> </ul>But I dont know what to put instead of the XXXX.
I should find a function calling the actual page slug.
Any idea?
Forum: Fixing WordPress
In reply to: Hide sub pages or specific page in query_postsIt works fine! Thank you very much for your help Michael! Topic resolved!