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
(function($) { | |
$.fn.changeElementType = function(newType) { | |
return this.each(function() { | |
var attrs = {}; | |
$.each(this.attributes, function(idx, attr) { | |
attrs[attr.nodeName] = attr.nodeValue; | |
}); | |
$(this).replaceWith(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 | |
/** | |
* Remove date ranges from post titles | |
* | |
* @author ericpedia | |
* @since 2014-08-26 | |
* | |
*/ |
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
# How to upload local db to meteor: | |
# -h = host, -d = database name, -o = dump folder name | |
mongodump -h 127.0.0.1:3002 -d meteor -o meteor | |
# get meteor db url, username, and password | |
meteor mongo --url myapp.meteor.com | |
# Response will be something like this: | |
# mongodb://client:f8f6d5aa-1213-008f-31c8-e9e059515615@production-db-a3.meteor.io:27017/myapp_meteor_com |
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
var max1 = 85; | |
var max2 = 61; | |
var max3 = 94; | |
var max4 = 52; | |
index1 = Math.round(Math.random() * max1); | |
index2 = Math.round(Math.random() * max2); | |
index3 = Math.round(Math.random() * max3); | |
index4 = Math.round(Math.random() * max4); |
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 get_header(); ?> | |
<div id="content"> | |
<div class="main-top"> | |
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> | |
<article id="page-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<h1><?php the_title(); ?></h1> | |
<div class="entry-content"> | |
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
WP_Query Object | |
( | |
[query_vars] => Array | |
( | |
[post_type] => any | |
[posts_per_page] => 5 | |
[s] => test | |
[error] => | |
[m] => 0 | |
[p] => 0 |
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 | |
$wp_query = new WP_Query( array( | |
'post_type' => 'any', | |
'posts_per_page' => '5', | |
// If we just set the vars above, the query returns posts as expected. But setting | |
// a search term causes the query to return 0 results (if Relevanssi is activated) | |
's' => 'test', // or get_search_query(), or a variable containing search term |
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 | |
/** | |
* The template for displaying Search Results pages. | |
* | |
* @package WordPress | |
* @subpackage Twenty_Ten | |
* @since Twenty Ten 1.0 | |
*/ | |
?> |
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
// Problem: This adds the term to the taxonomy, but it does not connect it to the post. It seems to connect it to the revision or something. | |
// Problem: When the title updates, the custom field does not update until after saving twice. | |
add_filter ('title_save_pre','w559_title_hook'); | |
function w559_title_hook($title) { | |
global $post; | |
$id = get_the_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 | |
/** Loop through all the files in a folder **/ | |
function loop_through_folder_by_extension($path, $extension) { | |
$processedFiles = array(); | |
$errors = array(); | |
foreach ( "{$path}/*.{$extension}" as $filename ) { |
NewerOlder