Digital Raindrops
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Twenty Eleven Previous and Next Link HelpOnly the ones you adjusted, WordPress will look in the child theme first for the layout files then fall back to the parent theme.
If we are changing index.php then we would copy the file from the parent theme to the child and make our changes in the copy.
Any additional functional code in functions.php can be moved to the child themes function.php, but the function name must not exist in both unless the function is pluggable, then the child fumction will be used.
Please mark this topic as resolved once you have fixed the issue.
HTH
David
Forum: Themes and Templates
In reply to: Menu Mod TwentyelevenPS – …also, the Twenty Ten theme folder is totally invisible too from dashboard. Only newly added themes from Network Admin dashboard are visible…
Did you make sure the parent and child theme are active in the Network Admin > Themes area?
David
Forum: Fixing WordPress
In reply to: how to get_post_meta and if else statementWould it no be as easy just to test the metadata, instead of using a function?
By looking at the call it is already inside the loop, so this would be quicker and less code than using another function!
<?php if( get_post_meta( the_ID(), 'video', true ) ) { echo get_post_meta( the_ID(), 'video', true ); } else { if( has_post_thumbnail() ) the_post_thumbnail('100%-thumb'); } ?>HTH
David
Forum: Themes and Templates
In reply to: styling the_meta()Yes it is a part of the code function, so it means that post meta is returning something.
This line means that it must be finding keys with no value!
if ( $keys = get_post_custom_keys() ) {HTH
David
Forum: Themes and Templates
In reply to: Child theme vs editing a (renamed) originalIt is a matter of assesing what is right for your client.
Lets say you take a nice theme “has most of what we need” and it has a vulnerability down the line, lets take the recent 2011 tim thumb vulnerability, many theme and plugin authors copied the tim thumb code to their files, over a period of time before the hackers found the exploit.
If you are using a child theme it is easy to replace or update the parent theme, most times without the child theme being affected, this is also true for deprecated code calls, if the theme author updates the parent then it is easy to deal with!
The other way you copy the theme re-name it, change the code and styles for your client, the original theme you used gets updated but your theme does not and is then open to an attack?
If you are not maintaining the content, you should still be in the loop for updating the theme, looking at any updates and how they affect the theme, at the end of the day it is your reputation as well, “that theme they done only worked for a while, then it stopped, not using them again, had to get another theme”
If it is a paid theme who will get any update notice?
All you can do is educate the person that is maintaining the site what to do, as WordPress is never finished and is always evolving, so what works today may not in a couple of years!
HTH
David
Forum: Themes and Templates
In reply to: styling the_meta()Same principal applies but with your div nested!
<?php if( the_meta() ) : ?> <div class="post-meta"> <!-- any other html code --> <div class="cfield"> <?php the_meta(); ?> </div> </div> <?php endif; ?>HTH
David
Forum: Fixing WordPress
In reply to: using child theme, functions.php error?I keep getting this error SOMETIMES… when you reload the page a few times
I tried several page loads in quick time and did not get any error, the pages load fast so it is not timing, are you logged in as admin when it happens or as a visitor.
The error is generated by the function get_file_data, reading the comments it is likely a plugin that is causing it.
/** * Retrieve metadata from a file. * * Searches for metadata in the first 8kiB of a file, such as a plugin or theme.Something is passing in an empty filename as these are the lines, it is trying to open and close an empty file
// We don't need to write to the file, so just open for reading. $fp = fopen( $file, 'r' ); // Pull only the first 8kiB of the file in. $file_data = fread( $fp, 8192 ); // PHP will close file handle, but we are good citizens. fclose( $fp );HTH
David
Forum: Themes and Templates
In reply to: styling the_meta()Never edit WordPress core files
Use the function to test to see if the post has any metadata, then output only if it has!
<?php if( the_meta() ) : ?> <div class="cfield"> <?php the_meta(); ?> </div> <?php endif; ?>HTH
David
Forum: Themes and Templates
In reply to: Don't display the_date(); on first postHi try a compare using date and strtotime() php functions!
Use strtotime(‘ ‘) or strtotime(‘now’) for today!
ALL UNTESTED
Outside the loop single.php:<?php global $post; ?> <?php //Get only the day and not the time ?> <?php $today = date('Y-m-d', strtotime(' ') ); ?> <?php $when = date('Y-m-d', strtotime($post->post_date); ?> <?php if ( $when != $today ): ?> <div class="home-dates"><?php the_date('M j, o') ?></div> <?php endif; ?>Inside the Loop:
<?php if ( the_date('Y-m-d') != date('Y-m-d', strtotime(' ') ): ?> <div class="home-dates"><?php the_date('M j, o') ?></div> <?php endif; ?>Different output for tody’s posts Breaking News!
<?php if ( the_date('Y-m-d') == date('Y-m-d', strtotime(' ') ): ?> <h3>Breaking News!</h3> <?php else: ?> <div class="home-dates"><?php the_date('M j, o') ?></div> <?php endif; ?>HTH
David
Forum: Themes and Templates
In reply to: Twenty Eleven Previous and Next Link HelpOn the single post they are on the same line next to each other with Internet Explorer, which browser are you seeing the change?
Warning:
You have modified the twenty eleven theme, when a security patch or a new release of WordPress comes out, if you choose to upgrade the theme, you will loose all your changes, as the upgrade deletes the theme files and replaces them.Either create a child theme, and move all your changes or download your twenty eleven theme folder, rename the folder, change the theme name in style.css to one of your own, upload and activate the renamed theme.
Once you have the new theme activated then overwrite the twenty eleven theme with a fresh downloaded copy, when twenty eleven is updated you then will not loose your changes!
Regards
David
Forum: Fixing WordPress
In reply to: One post – two separate partsUse the <!–nextpage–> tag in the HTML view!
type <!–nextpage–> (you need to use the html-mode of the editor to do so).
So in the [ HTML ] view you would have:
<!--nextpage--> <h2>Ingredients</h2>Or add section links in the page
<a href="#ingredients">Go to Ingredients</a>Link in the page!
<h2 id="ingredients">Ingredients</h2>On YouTube
HTH
David
(i’m in header.php and i didn’t call <?php if ( have_posts() )
In header php use is_single() or is_singular( $post_type ), this code is not tested!
// Is it a single post outside the loop? if ( is_single() || is_singular( array('post') ) ) { // Use the $post global global $post; // Get the categories from the post meta $categories = wp_get_post_categories( $post->ID ); if ($categories) { //Do menu stuff here! } }HTH
David
Forum: Fixing WordPress
In reply to: jQuery and WordPressWe had this same question last week, a script to use the left and right keys to navigate pages.
This was the solution, it will depend on what you are trying to do, and if there are no clashes with existing scripts.
WordPress does not like the
$(document).ready(function (), so you wrap it in a file, function like this, then call the file in functions.php(function($){ 'simple script goes here' })(jQuery);HTH
David
Forum: Themes and Templates
In reply to: Image Background/Border People ListsAdd this to the style.css
Test with FireFox > FireBug > Live Edit
.user-thumbnail { background: #E0E0E0; max-width: 96px; padding: 5px; border-radius: 4px 4px 4px 4px; box-shadow: 0 0 4px #CCCCCC; border: solid 1px #CCC; } .user-thumbnail img { border-radius: 4px 4px 4px 4px; }HTH
David
Forum: Fixing WordPress
In reply to: How to add pagination on a category pageWordPress already has a global variable called $paged just use that!
<?php query_posts( array( 'posts_per_page' => 5, 'cat' => '15', 'paged'=> $paged )); ?>HTH
David