Get author information in WordPress while loop

<?php

while ( have_posts() ) : the_post();

$author_id=$post->post_author;

//Avatar image

echo get_avatar( 32 );

//Author “Nick Name”

echo the_author_meta( ‘user_nicename’ , $author_id );

echo get_userdata($author_id)->nickname;

//Author “Display Name”

echo the_author_meta( ‘display_name’ , $author_id );

//Author “E-Mail address”

echo the_author_meta( ‘user_email’, $author_id );

//Author user loin

echo get_userdata($author_id)->user_login;

 

Advertisement

WordPress Post Thumbnail with different sizes

<?php

//Post thumbnail sizes

$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array(316, 140) );

$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘large’ );

$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘medium’ );

$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘thumbnail’ );

$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ );

echo $image[0];

//Woo-commerce images
the_post_thumbnail( ‘shop_thumbnail’ ); // Shop thumbnail (180 x 180 hard cropped)
the_post_thumbnail( ‘shop_catalog’ ); // Shop catalog (300 x 300 hard cropped)
the_post_thumbnail( ‘shop_single’ ); // Shop single (600 x 600 hard cropped)

Woo-Commerce redirect using filters

/**
* Redirect to a specific page when clicking on Continue Shopping in the cart
*
* @return void
*/
function wc_custom_redirect_continue_shopping() {
$url = site_url().’/product-category/accessories/’;
return $url;
}
add_filter( ‘woocommerce_continue_shopping_redirect’, ‘wc_custom_redirect_continue_shopping’ );

/**
* Changes the redirect URL for the Return To Shop button in the cart.
*
* @return string
*/
function wc_empty_cart_redirect_url() {
$url = site_url().’/product-category/accessories/’;
return $url;
}
add_filter( ‘woocommerce_return_to_shop_redirect’, ‘wc_empty_cart_redirect_url’ );

HTML 5 Standard Events in JavaScript

Offline => Triggers when the document goes offline
Onabort => Triggers on an abort event
onafterprint => Triggers after the document is printed
onbeforeonload => Triggers before the document loads
onbeforeprint => Triggers before the document is printed
onblur => Triggers when the window loses focus
oncanplay => Triggers when media can start play, but might has to stop for buffering
oncanplaythrough => Triggers when media can be played to the end, without stopping for buffering
onchange => Triggers when an element changes
onclick => Triggers on a mouse click
oncontextmenu => Triggers when a context menu is triggered
ondblclick => Triggers on a mouse double-click
ondrag => Triggers when an element is dragged
ondragend => Triggers at the end of a drag operation
ondragenter => Triggers when an element has been dragged to a valid drop target
ondragleave => Triggers when an element is being dragged over a valid drop target
ondragover => Triggers at the start of a drag operation
ondragstart => Triggers at the start of a drag operation
ondrop => Triggers when dragged element is being dropped
ondurationchange => Triggers when the length of the media is changed
onemptied => Triggers when a media resource element suddenly becomes empty.
onended => Triggers when media has reach the end
onerror => Triggers when an error occur
onfocus => Triggers when the window gets focus
onformchange => Triggers when a form changes
onforminput => Triggers when a form gets user input
onhaschange => Triggers when the document has change
oninput => Triggers when an element gets user input
oninvalid => Triggers when an element is invalid
onkeydown => Triggers when a key is pressed
onkeypress => Triggers when a key is pressed and released
onkeyup => Triggers when a key is released
onload => Triggers when the document loads
onloadeddata => Triggers when media data is loaded
onloadedmetadata => Triggers when the duration and other media data of a media element is loaded
onloadstart => Triggers when the browser starts to load the media data
onmessage => Triggers when the message is triggered
onmousedown => Triggers when a mouse button is pressed
onmousemove => Triggers when the mouse pointer moves
onmouseout => Triggers when the mouse pointer moves out of an element
onmouseover => Triggers when the mouse pointer moves over an element
onmouseup => Triggers when a mouse button is released
onmousewheel => Triggers when the mouse wheel is being rotated
onoffline => Triggers when the document goes offline
onoine => Triggers when the document comes online
ononline => Triggers when the document comes online
onpagehide => Triggers when the window is hidden
onpageshow => Triggers when the window becomes visible
onpause => Triggers when media data is paused
onplay => Triggers when media data is going to start playing
onplaying => Triggers when media data has start playing
onpopstate => Triggers when the window’s history changes
onprogress => Triggers when the browser is fetching the media data
onratechange => Triggers when the media data’s playing rate has changed
onreadystatechange => Triggers when the ready-state changes
onredo => Triggers when the document performs a redo
onresize => Triggers when the window is resized
onscroll => Triggers when an element’s scrollbar is being scrolled
onseeked => Triggers when a media element’s seeking attribute is no longer true, and the seeking has ended
onseeking => Triggers when a media element’s seeking attribute is true, and the seeking has begun
onselect => Triggers when an element is selected
onstalled => Triggers when there is an error in fetching media data
onstorage => Triggers when a document loads
onsubmit => Triggers when a form is submitted
onsuspend => Triggers when the browser has been fetching media data, but stopped before the entire media file was fetched
ontimeupdate => Triggers when media changes its playing position
onundo => Triggers when a document performs an undo
onunload => Triggers when the user leaves the document
onvolumechange => Triggers when media changes the volume, also when volume is set to “mute”
onwaiting => Triggers when media has stopped playing, but is expected to resume

Customize Login Page Logo

Add below lines in the functions.php file:
function   custom_login_logo()
{
echo   ‘<style  type=”text/css”> h1 a {
background-image:url(‘ . get_bloginfo(‘template_directory’) . ‘/images/admin.png)  !important; } </style>’;
}
add_action(‘login_head’,  ‘custom_login_logo’);

Turning on wordpress and drupal debugging

WordPress

public_html/wp-config.php
Change wordpress debugging mode to true like below in wp-config.php
define(‘WP_DEBUG’, true);
or add code below
define( ‘SCRIPT_DEBUG’, true );

Drupal

sites/default/settings.php

Add below code in settings.php file.
$config[‘system.logging’][‘error_level’] = ‘verbose’;