Tag: Code

Embedded Post Customisation

Have you ever wanted to remove that unsightly site title?

Ever wanted to show who worked on the post?

Well I have and after quite a bit of searching and fiddling I figured it out.

 * Removes the title.
 * Adds the author's name.
add_action( 'embed_content', 'embed_author' );
 * Add the author div to the embed iframe.
function embed_author() {
    $output = '<div class="wp-embed-author">';
    $output .= '&mdash; ';
    $output .= get_the_author();
	$output .= " ";
    $output .= get_avatar( get_the_author_meta( 'ID' ), 20 );
    $output .= '</div>';
    echo $output;

Just slap this into your theme somewhere (in Beans they have a file called “Embed” that i slipped it into) and voilĂ ! Your site title will disappear and be replaced with the author of the post!

Filed under: WordPressTagged with: ,

Beans Menu Customisation

To change the appearance of the primary menu in the Beans Theme simply alter the “tm-primary-menu”. I’ve done this easily by adding some Additional CSS like so:

To change the text colour of the menu:

.tm-primary-menu .menu-item > a
	color: #ccc;

In order to change the background and text colour of the current menu item (meaning the link to the page your on at the moment).

.tm-primary-menu .current-menu-item > a {
	background-color: #444
	color: #ccc

To change the background and text colour of whichever menu item the user is hovering the mouse cursor over.

.tm-primary-menu .menu-item > a:hover
	background-color: #444;
	color: #ccc;
Filed under: WordPressTagged with: ,

Width, Smallest Width and Height

Did you know you can check the smallest width of whatever virtual device your using with this code?

Configuration config = getResources().getConfiguration();

Because i sure as heck didn’t.

Also you can get the current width and height with this:

DisplayMetrics displayMetrics = this.getResources().getDisplayMetrics();
            float dpHeight = displayMetrics.heightPixels / displayMetrics.density;
            float dpWidth = displayMetrics.widthPixels / displayMetrics.density;

Be careful though as this apparently changes depending on if the device is in portrait or landscape mode.

Filed under: AndroidTagged with: ,