
GENERAL
-
ServerName not found
-
Msg:
-
FQDN not found
-
mysqli connection exception, server name not found
-
Ans:
-
Rebuild wordpress after cleaning all old data on disk.
-
Write parameter debug log
$sudo vi ./your_wp_html/wp-includes/functions.php
--- functions.php ---
...
/**
* Simple helper to debug to the console
*
* @param $data object, array, string $data
* @param $context string Optional a description.
*
* @return string
*/
function debug_to_console($data, $context = 'Debug in Console') {
// Buffering to solve problems frameworks, like header() in this and not a solid return.
ob_start();
$output = 'console.info(\'' . $context . ':\');';
$output .= 'console.log(' . json_encode($data) . ');';
$output = sprintf('<script>%s</script>', $output);
echo $output;
}
...
------
# Now Usage in any .php file
debug_to_console($xxx)
Result:
POSTS
-
Order posts by last modified/update date
$sudo vi {your_wp_html}/wp-content/themes/{your_current_theme}/functions.php
--- functions.php ---
...
# Remove `$query->is_main_query()` check if needs
function lmt_orderby_modified_posts( $query ) {
if( $query->is_main_query() && !is_admin() ) {
if ( $query->is_home() || $query->is_category() || $query->is_tag() ) {
$query->set( 'orderby', 'modified' );
$query->set( 'order', 'desc' );
}
}
}
add_action( 'pre_get_posts', 'lmt_orderby_modified_posts' );
...
------
Leave a Reply