Digital Raindrops
Forum Replies Created
-
First don’t change the twenty eleven theme but use a child theme.
For the Logo just overlay it on a header imgage and turn off the text!
For the graphics there are a number of plugins out there, this option uses Woo Themes Flex Slider and has a child theme to get you started.
HTH
David
Forum: Fixing WordPress
In reply to: How to use WP_Query to filter by post excerptForum: Fixing WordPress
In reply to: Display search results on another pageIf you copy index.php and save it as search.php then WordPress Template Hierarchy will use the new file.
HTH
David
Forum: Fixing WordPress
In reply to: get_post_meta not workingYou have a good grasp of the get_post_meta()
The If statement as we know will return only a true or false, where ”, 0, null, or empty will return a false and ‘Hello’ or a non-zero number will return a true.
” or ‘null’ should both return a false so testing for a value being true might work better.
if( $meta ) will return true if not null or empty
You could also try isset()
if( isset($meta) && $meta )HTH
David
Forum: Themes and Templates
In reply to: CSS justify text not working on PagesAs I said it is because you have the paragraph text inside <div></div> tags, in the editor on the right you have two tabs!
[ Visual ][ HTML ] click on the HTML view and you will see the markup!HTH
David
Forum: Fixing WordPress
In reply to: Add Image Size – doing width but not height or CropThat is fine it will resize it on the fly!
Just paste this in to test
<?php if(has_post_thumbnail()) : ?> <div style="display:block; float:left;"> <?php the_post_thumbnail( array(150,150) ); ?> <?php the_post_thumbnail( array(90,90) ); ?> <?php the_post_thumbnail( array(50,50) ); ?> </div> <?php endif; ?>David
Forum: Fixing WordPress
In reply to: Add Image Size – doing width but not height or CropThe default thumbnail is 150px * 150px so just use the thumbnail and pass an array with the size!
if(has_post_thumbnail()) { the_post_thumbnail( array(90,90) ); }For the twenty eleven theme!
<?php if(has_post_thumbnail()) : ?> <div class="alignleft"> <?php the_post_thumbnail( array(90,90) ); ?> </div> <?php endif; ?>HTH
David
Forum: Themes and Templates
In reply to: CSS justify text not working on PagesYou have the justified, as a div?
<div align=”justify”>Flora Deborah is a photographer based in London (Wapping E1W).
Born 1984 in Evian les Bains, Haute SavoieYou should select the text in the WordPress editor and use the Justify, then in the HTML view you will get something like this!
<h1>My Title 1</h1>
<p style=”text-align: justify;”>Justified: Cras eget justo at metus volutpat volutpat. Vestibulum tristique mattis augue, et mattis velit lacinia non. Pellentesque venenatis gravida justo ut cursus. Nunc sagittis, purus eu facilisis semper, neque urna sollicitudin libero, et semper sapien quam a nisl.</p><h1>My Title 2</h1>
<p style=”text-align: justify;”>Justified Quisque cursus ornare dolor, non dignissim lacus molestie a Cras eget justo at metus volutpat volutpat. Vestibulum tristique mattis augue, et mattis velit lacinia non. Pellentesque venenatis gravida justo ut cursus.</p>HTH
David
Forum: Fixing WordPress
In reply to: get_post_meta not workingJust the way I described it, sorry to confuse things but scope = include, scope is more PHP than WordPress.
This PHP page might help you understand it more, but in short terms, $post is just a WordPress variable and to include it in a function you use the global $post; call
In PHP global variables must be declared global inside a function if they are going to be used in that function.
To use a WordPress or Custom variable inside a function you must include it with the word global.
We could set our own variable as an example in the loop.php or content.php:
<php $day = date( 'd',strtotime( esc_html( get_the_date() ) ) ); $month = date( 'M',strtotime( esc_html( get_the_date() )) ); function get_my_date() { global $day, $month; return 'Posted ' .$month .' ' .$day; } ?>Then in the section I want to call the function.
<?php echo get_my_date(); ?>This should return:
Posted May 09HTH
David
Forum: Fixing WordPress
In reply to: get_post_meta not workingI’m using a function because there are 16 places I need that code.
I can only think of a few places?
The function call will only work after the call to the_post() when $post is in scope!
The best place is inside ‘the loop’ (loop.php or content.php), when you know thw $post is already in scope.
Alternative places index.php, archive.php, category.php, search.php and in single.php
The function can be changed to return $meta;
return $meta;Example code for twenty eleven index.php
<?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php echo islink('dad'); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?>it’s my first crack at a php function, so I can’t back down now!
Yes you can, it is good to re-evaluate, re-write, improve the code, or back down, shows you are willing to learn new or different ways to code.
It is a learning curve, I can often write a function or code block, find another way and just “rip it up and start again!”
HTH
David
If your theme support menus in one location that is fine!
create a new empty menu give it a name and save, in the left column you will see a menu option for URL
Thanks..but I’m lost at this sentence:
Look at how it is one in this Screenshot after you have your menu you set it in the “Theme Locations”.
HTH
David
Does your theme supports custom menus from Appearance > Menus > New Menu
If so create a new menu, for the ABC add a type ‘URL Link’ with the URL of just a single character which is a ‘hash’ #
Add the child menu items and drag then right to indent under the parent ‘ABC’
ABC
-DEF
-GHI
-JKL‘Save’ the menu!
After creating the new menu you should see “Template Locations” where you assign the menu to a location, again ‘Save’?
Thats it clicking ABC will not navigate away, and the visitor can select a child sub-menu item!
HTH
David
Forum: Fixing WordPress
In reply to: get_post_meta not workingAs it is inside a function you need to bring the $post into scope!
<?php function islink($key){ global $post; $meta = get_post_meta($post->ID, '_link', true); if($meta != '') { echo '<a href="',the_field($key2),'">',the_field($key),'</a>'; } else { echo the_field($key); } }?>As you are learning you could shorten it with sorthand statements
$return_value = the_statement ? ‘where ? = then is true’ : ‘where : = else is false’;<?php function islink($key){ global $post; $meta = get_post_meta($post->ID,'_link',true) ? '<a href="',the_field('_link'),'">',the_field('_link'),'</a>' : the_field('_link'); echo $meta; } }?>Functions are not really needed in this scenario, you could call it without the use of a function, directly in the page, page content loop, or posts content loop, templates code, where the $post is already in scope!
<?php $meta = get_post_meta($post->ID,'_link',true) ? '<a href="',the_field('_link'),'">',the_field('_link'),'</a>' : the_field('_link'); echo $meta; ?>HTH
David
Forum: Fixing WordPress
In reply to: Uploading a pre-written page with images to wordpress siteBlog Publishing Tools?
As you are a Window user try the free Windows Live Writer, you can create your pages or posts on your PC and then publish.
If you was on MAC then there is MarsEdit which is not as powerful as Livewriter and is not free, but it is a blog publishing tool.
HTH
David
Forum: Fixing WordPress
In reply to: cropped thumbnail become featured image?Why not change the thumbnail or medium image size in Settings > Media, then you can call it like:
if(has_post_thumbnail()) { the_post_thumbnail('thumbnail'); }Or:
if(has_post_thumbnail()) { the_post_thumbnail('medium'); }These images are created by WordPress so you can change the size to whatever you want, unless it is for a client, then you could change the default image sizes in code.
Another option is to get the featured image (400 * 400) and set the width to 50% 200px * 200px this should resize the image proportional.
if(has_post_thumbnail()) { the_post_thumbnail( array(200,200) ); }HTH
David