Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):
class Shop extends Eloquent {}
Using custom table name
protected $table = 'my_shops';
add_filter('post_thumbnail_html', 'slug_responsive_img', 5, 5); | |
//Image sizes for Interchange | |
add_image_size( 'fd-lrg', 1024, 99999); | |
add_image_size( 'fd-med', 768, 99999); | |
add_image_size( 'fd-sm', 320, 9999); | |
function slug_responsive_img($html, $post_id, $post_thumbnail_id, $size, $attr) { | |
//make image links | |
$attachment_id = $post_thumbnail_id; | |
$default = wp_get_attachment_image_src($attachment_id); |
server { | |
listen 80; | |
root /var/www/craft.dev/public; | |
index index.php index.html index.htm; | |
server_name craft.dev; | |
location / { | |
try_files $uri $uri/ @rewrites; |
<?php | |
function auto_login() { | |
if (!is_user_logged_in()) { | |
//determine WordPress user account to impersonate | |
$user_login = 'anonymous'; | |
//get user's ID | |
$user = get_userdatabylogin($user_login); | |
$user_id = $user->ID; |
<?php | |
/** | |
* Example filter to add text style to TinyMCE filter with Mark's "MRW TinyMCE Mods" plugin | |
* | |
* Adds a "Text Styles" submenu to the "Formats" dropdown | |
* | |
* This would go in a functions.php file or mu-plugin so you don't have to modify the original plugin. | |
* | |
* $styles array Contains arrays of style_format arguments to define styles. | |
* Note: Should be an "array of arrays" |
# Run me with: | |
# | |
# $ nginx -p /path/to/this/file/ -c nginx.conf | |
# | |
# All requests are then routed to authenticated user's index, so | |
# | |
# GET http://user:password@localhost/_search?q=* | |
# | |
# is rewritten to: | |
# |
Use case: Database entries are represented in a table. By grabbing and moving a row up or down the table, you can change the entries' order/position. The changes are submitted automatically via ajax.
-- delete any usermeta specific to the other subsites | |
delete from wp_usermeta where meta_key regexp '^wp_([0-9]+)_'; | |
-- duplicate the wp_usermeta structure in a working data table, | |
-- but add a unique index for filtering out duplicates | |
create table _fix_usermeta like wp_usermeta; | |
alter table _fix_usermeta add unique(user_id, meta_key); | |
-- copy the site-specific usermeta, keeping only the last of each duplicate | |
insert into _fix_usermeta |
function wp_api_encode_acf($data,$post,$context){ | |
$data['meta'] = array_merge($data['meta'],get_fields($post['ID'])); | |
return $data; | |
} | |
if( function_exists('get_fields') ){ | |
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3); | |
} |