This file contains hidden or 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
| ++++++++++++ | |
| Function.php | |
| ++++++++++++ | |
| // Display Post by Specific Category in Loop | |
| add_action( 'pre_get_posts', function ( $q ) { | |
| if( $q->is_home() && $q->is_main_query() ) { | |
| $q->set( 'posts_per_page', 4 ); | |
| $q->set( 'tag_ID', Portfolio ); |
This file contains hidden or 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
| Copy this code to function.php | |
| //Sitemap XML | |
| /* | |
| function to create sitemap.xml file in root directory of site | |
| */ |
This file contains hidden or 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
| class Image_Picker extends WP_Widget | |
| { | |
| function Image_Picker() { | |
| $widget_ops = array('classname' => 'Image_Picker', 'description' => 'Pick 2 images from media library'); | |
| $this->WP_Widget('Image_Picker', 'Image Picker', $widget_ops); | |
| } | |
| function form($instance) { | |
| //WIDGET BACK-END SETTINGS | |
| $instance = wp_parse_args((array) $instance, array('link1' => '', 'link2' => '')); |
This file contains hidden or 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
| //Basic SEO | |
| function basic_wp_seo() { | |
| global $page, $paged, $post; | |
| $default_keywords = 'wordpress, plugins, themes, design, dev, development, security, htaccess, apache, php, sql, html, css, jquery, javascript, tutorials'; // customize | |
| $output = ''; | |
| // description | |
| $seo_desc = get_post_meta($post->ID, 'mm_seo_desc', true); | |
| $description = get_bloginfo('description', 'display'); | |
| $pagedata = get_post($post->ID); |
This file contains hidden or 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
| // Display Post by Specific Category in Loop | |
| add_action( 'pre_get_posts', function ( $q ) { | |
| if( $q->is_home() && $q->is_main_query() ) { | |
| $q->set( 'category_name', Portfolio ); | |
| $q->set( 'posts_per_page', 4 ); | |
| $q->set( 'tag_ID', Portfolio ); | |
| } | |
| }); | |
This file contains hidden or 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
| //Embed Images | |
| function get_images_from_media_library() { | |
| $args = array( | |
| 'post_type' => 'attachment', | |
| 'post_mime_type' =>'image', | |
| 'post_status' => 'inherit', | |
| 'posts_per_page' => 5, | |
| 'orderby' => 'rand' | |
| ); | |
| $query_images = new WP_Query( $args ); |
This file contains hidden or 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
| // Custom Widget Area | |
| if (function_exists('register_sidebar')) { | |
| register_sidebar(array( | |
| 'name' => 'Sidebar 1', | |
| 'id' => 'sidebar1', | |
| 'description' => 'This is the widgetized sidebar1', | |
| 'before_widget' => '<div id="%1$s" class="widget-container %2$s">', | |
| 'after_widget' => '</div>', | |
| 'before_title' => '<h1>', |
This file contains hidden or 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 | |
| /* | |
| Template Name: Blog | |
| */ | |
| ?> | |
| <?php get_header(); ?> | |
| <article> | |
| <?php // Display blog posts on any page @ http://m0n.co/l | |
| $temp = $wp_query; $wp_query= null; |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html class="no-js" <?php language_attributes(); ?>> | |
| <head> | |
| <meta charset=<?php bloginfo('charset'); ?>> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <meta name="description" content="<?php bloginfo('description'); ?> | |
| <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
| <title> | |
| <?php echo home_url(); ?><?php bloginfo('name'); ?> |