Basics | Working with DOM | Working with JS | Working With Functions |
---|---|---|---|
Variables | Accessing Dom Elements | Add/Remove Array Item | Add Default Arguments to Function |
Functions | Grab Children/Parent Node(s) | Add/Remove Object Properties | Throttle/Debounce Functions |
Objects | Create DOM Elements | Conditionals | |
Add Elements to the DOM | Loops |
- Import the likes table (likes.sql) into our DB
- write the HTML for the like button interface (index.php)
- Add the CSS for the heart button (css/style.css)
- Add the count_likes function (includes/functions.php)
- add the likes interface function (includes/functions.php)
- add the JS Fetch() call when the user clicks the heart button (includes/footer.php)
- add the ajax handler PHP file to update the DB behind the scenes (ajax-handlers/like-unlike.php)
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 | |
/* | |
Template Name: Post thumbnails by taxonomy term | |
*/ | |
//edit these to match the stuff you registered in your custom post type plugin | |
$post_type = 'work'; | |
$taxonomy = 'work_category'; ?> | |
<?php get_header(); ?> |
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 | |
/** | |
* configure error display (production vs development) | |
*/ | |
/* ------------------configure these variables----------------- */ | |
define('DEBUG_MODE', 0); | |
define('ROOT_DIR', '' ); |
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
if($width >= $pixels){ | |
//wider than desired size | |
$newwidth = $pixels; | |
//calculate the correct height | |
$newheight=($height/$width) * $newwidth; | |
}else{ | |
//smaller than desired size. preserve original width and height | |
$newwidth=$width; | |
$newheight=$height; | |
} |
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 //connect to DB | |
require('config.php'); | |
include_once('includes/functions.php'); | |
//get 10 of the recent published posts out of the DB | |
$query = "SELECT posts.title AS post_title, posts.body AS description, posts.image AS url, users.username | |
FROM posts, users | |
WHERE posts.user_id = users.user_id | |
AND posts.is_published = 1 | |
ORDER BY date DESC |
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 | |
//hide all of this file if the post if password protected | |
if( post_password_required() ){ | |
return; | |
} | |
//get a distinct count of comments vs. pings | |
$comm = get_comments( array( | |
'status' => 'approve', | |
'post_id' => $id, //This post |
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
/* | |
Theme Name: Twenty Ten | |
Theme URI: http://wordpress.org/ | |
Description: The 2010 default theme for WordPress. | |
Author: wordpressdotorg | |
Author URI: http://wordpress.org/ | |
Version: 1.0 | |
Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional) | |
License: |
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 | |
/* | |
Plugin Name: Unique Name Here | |
Plugin URI: http://yoursite.com/plugin | |
Description: Does an awesome thing | |
Version: 0.1 | |
Author: Your Name Here | |
Author URI: http://yoursite.com | |
License: GPLv3 | |
*/ |
NewerOlder