In this tutorial we will show you how to have a PHP Powered Web Server send/obtain data to/from a separate MySQL Database server before presenting the HTML output to the client browser.
PHP Namespaces
What are namespaces? In the broadest definition namespaces are a way of encapsulating items. This can be seen as an abstract concept in many places.
Working with Cookies in PHP
Cookies are text files stored on the client computer and they are kept of use tracking purpose. PHP transparently supports HTTP cookies.
How To Install LAMP in Ubuntu 18.04
The objective of this tutorial is to install the LAMP stack (Linux, Apache, MySQL and PHP server) on Ubuntu 18.04 “Bionic Beaver”, which is now available in the ITLC’sĀ Xen Orchestra sandbox as a “Quick Instance”.
Sort Functions For Arrays in PHP
The elements in an array in PHP can be sorted in alphabetical or numerical order, descending or ascending.
PHP Functions
PHP functions are similar to other programming languages. A function is a piece of code which takes one more input in the form of parameter and does some processing and returns a value.
Use Google’s Copy Of JQuery in WordPress
Grabs jQuery from Google’s CDN which your visitors will hopefully have cached. This can then be called in your header with <?php wp_enqueue_script("jquery"); ?>
// Call the google CDN version of jQuery for the frontend // Make sure you use this with wp_enqueue_script('jquery'); in your header function itlc_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null); wp_enqueue_script('jquery'); } if (!is_admin()) add_action("wp_enqueue_scripts", "itlc_jquery_enqueue", 11);
Custom Excerpt Length in WordPress
Define how many words to return when using the_excerpt();
.
//custom excerpt length function itlc_custom_excerpt_length( $length ) { //the amount of words to return return 20; } add_filter( 'excerpt_length', 'itlc_custom_excerpt_length');
Post Thumbnails in WordPress RSS Feed
Include the post thumbnail in your RSS feed.
// Put post thumbnails into rss feed function itlc_feed_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '' . $content; } return $content; } add_filter('the_excerpt_rss', 'itlc_feed_post_thumbnail'); add_filter('the_content_feed', 'itlc_feed_post_thumbnail');
Customise WordPress Admin Footer
Change the message that appears in the admin footer, why not give yourself a credit for the theme?
// Customise the footer in admin area function itlc_footer_admin () { echo 'Theme designed and developed by <a href="#" target="_blank">YourNameHere</a> and powered by <a href="http://wordpress.org" target="_blank">WordPress</a>.'; } add_filter('admin_footer_text', 'itlc_footer_admin');