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 tattoo_submit() { | |
if (isset($_POST["addtattoo"])) { | |
$title = "Tattoo : ". $_POST["tatooInput"]; | |
$my_post = array( | |
'post_title' => $title, | |
'post_status' => 'publish', | |
'post_author' => 1, |
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 | |
$gallery = get_field('images'); | |
$rand = array_rand($gallery, 1); | |
if( $gallery ): ?> | |
<img src="<?php echo $gallery[$rand]['sizes']['large']; ?>" alt="<?php echo $gallery[$rand]['alt']; ?>" /> | |
<?php endif; ?> |
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
add_action( 'admin_menu', 'adjust_the_wp_menu', 999 ); | |
function adjust_the_wp_menu() { | |
remove_submenu_page( 'themes.php', 'theme-editor.php'); | |
remove_submenu_page( 'themes.php', 'themes.php'); | |
remove_submenu_page( 'themes.php', 'customize.php'); | |
remove_submenu_page( 'themes.php', 'widgets.php'); | |
remove_submenu_page( 'jetpack', 'jetpack'); | |
remove_submenu_page( 'index.php', 'update-core.php'); | |
} | |
add_action( 'login_head', 'namespace_login_style' ); |
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 | |
// Geo Redirect using Cloudflare | |
$activepage = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; | |
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"]; | |
$page_from = "www.domain.tld/"; | |
$page_to = "www.newdomain.tld/"; | |
?> | |
<!-- Country Code : <?php echo $country_code; ?> --> | |
<!-- Active URL : <?php echo $activepage; ?> --> |
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 | |
$images = get_field('gallery'); | |
if( $images ): ?> | |
<ul> | |
<?php foreach( $images as $image ): ?> | |
<li> | |
<a href="<?php echo $image['url']; ?>"> | |
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" /> |
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 | |
$attachment_id = get_field('field_name'); | |
$image_thumbnail = wp_get_attachment_image_src( $attachment_id, "thumbnail" ); | |
$image_medium = wp_get_attachment_image_src( $attachment_id, "medium" ); | |
$image_large = wp_get_attachment_image_src( $attachment_id, "large" ); | |
// url = $image[0]; | |
// width = $image[1]; | |
// height = $image[2]; | |
?> | |
<img data-interchange="[<?php echo $image_thumbnail[0]; ?>, (default)], [<?php echo $image_medium[0]; ?>, (large)]"/> |
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 | |
$location = get_field('location'); | |
if( !empty($location) ): | |
?> | |
<?php echo $location['lat']; ?> | |
<?php echo $location['lng']; ?>"> | |
<?php endif; ?> |
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
// Get And Cache Vimeo Thumbnails | |
function get_vimeo_thumb($id, $size = 'thumbnail_small') | |
{ | |
if(get_transient('vimeo_' . $size . '_' . $id)) | |
{ | |
$thumb_image = get_transient('vimeo_' . $size . '_' . $id); | |
} | |
else | |
{ | |
$json = json_decode( file_get_contents( "http://vimeo.com/api/v2/video/" . $id . ".json" ) ); |
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
/** | |
* Several functions relatting to blurring images on uploaded. | |
* @see https://codeable.io/community/how-to-watermark-wordpress-images-with-imagemagick/ | |
*/ | |
add_image_size( 'background-image-blurred', 1920, 1080, true ); | |
function generate_blurred_image( $meta ) { | |
$time = substr( $meta['file'], 0, 7); // Extract the date in form "2015/04" | |
$upload_dir = wp_upload_dir( $time ); // Get the "proper" upload 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
// Editing the WordPress Dashboard Header | |
function wp_admin_dashboard_header_colour() { | |
echo '<style type="text/css"> | |
#toplevel_page_edit-post_type-acf { display:none; } | |
</style>'; | |
} | |
add_action('admin_head', 'wp_admin_dashboard_header_colour'); |
NewerOlder