This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Njengah Tutorial Custom Post Type Example | |
//Hook | |
add_action('init', "njengah_tutorial_cpt"); | |
//Callback function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Code to Create Custom WordPress login form without plugin | |
* @author Joe Njenga | |
* @ gist - | |
*/ | |
// Step 1: Create shortcode | |
function njengah_add_login_shortcode() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Declare the global WooCoomerce Object & Post Object | |
global $woocommerce, $post; | |
//Assign the order ID using the $post->ID | |
$order = new WC_Order($post->ID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Redirect return to shop button to previous page | |
* | |
* @return $string | |
*/ | |
add_filter( 'woocommerce_return_to_shop_redirect', 'njengah_return_to_shop_to_previous_page' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function to get post ID By slug | |
*/ | |
function get_id_by_slug($page_slug, $slug_page_type = 'page') { | |
$find_page = get_page_by_path($page_slug, OBJECT, $slug_page_type); | |
if ($find_page) { | |
return $find_page->ID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display Category in WordPress | |
*/ | |
//Head hook to test the display | |
add_action('wp_head', 'test_category_name_display'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>CSS Not Last Child </title> | |
<style> | |
li { | |
list-style: none; | |
display: inline; | |
padding: 20px; |