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
import Foundation | |
import UIKit | |
extension UIView { | |
func fadeIn(_ duration: TimeInterval = 1.0, delay: TimeInterval = 0.0, completion: @escaping ((Bool) -> Void) = {(finished: Bool) -> Void in}) { | |
UIView.animate(withDuration: duration, delay: delay, options: UIViewAnimationOptions.curveEaseIn, animations: { | |
self.alpha = 1.0 | |
}, completion: completion) } | |
func fadeOut(_ duration: TimeInterval = 1.0, delay: TimeInterval = 0.0, completion: @escaping (Bool) -> Void = {(finished: Bool) -> Void in}) { |
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
// Error Alert - Usage Example: showAlert(withTitle: "Oops", message: "Please fill in both gravity fields.", viewController: self) | |
func showAlert(withTitle title: String, message: String, viewController: UIViewController) { | |
if viewController.presentedViewController == nil { // Prevent multiple alerts at the same time | |
let localizedTitle = NSLocalizedString(title, comment: "") | |
let localizedMessage = NSLocalizedString(message, comment: "") | |
let alert = UIAlertController(title: localizedTitle, message: localizedMessage, preferredStyle: .alert) | |
let action = UIAlertAction(title: "OK", style: .default, handler: nil) | |
alert.addAction(action) | |
viewController.present(alert, animated: true, completion: nil) |
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( 'init', 'my_add_excerpts_to_pages' ); | |
function my_add_excerpts_to_pages() { | |
add_post_type_support( 'page', 'excerpt' ); | |
} |
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_filter('post_gallery', 'my_post_gallery', 10, 2); | |
function my_post_gallery($output, $attr) { | |
global $post; | |
if (isset($attr['orderby'])) { | |
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']); | |
if (!$attr['orderby']) | |
unset($attr['orderby']); | |
} |
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_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); | |
add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); | |
function remove_width_attribute( $html ) { | |
$html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); | |
return $html; | |
} |
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
$(window).resize(function(){ | |
$('.className').css({ | |
position:'absolute', | |
left: ($(window).width() - $('.className').outerWidth())/2, | |
top: ($(window).height() - $('.className').outerHeight())/2 | |
}); | |
}); |
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(){ | |
function contentSwitcher(settings){ | |
var settings = { | |
contentClass : '.content', | |
navigationId : '#navigation' | |
}; | |
//Hide all of the content except the first one on the nav | |
$(settings.contentClass).not(':first').hide(); | |
$(settings.navigationId).find('li:first').addClass('active'); |
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
// Registering Custom Post Type for Replace_names | |
function custom_type_Replace_names() { | |
$labels = array( | |
'name' => 'Replace_names', | |
'singular_name' => 'Replace_name', | |
'add_new' => 'Add Replace_name', | |
'add_new_item' => 'Add New', | |
'edit_item' => 'Edit Replace_name', | |
'new_item' => 'New Replace_name', | |
'all_items' => 'All Replace_names', |
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
<meta name="keywords" content="<?php if(is_single()) { | |
$metatags = get_the_tags($post->ID); | |
foreach ($metatags as $tagpost) { | |
$mymetatag = apply_filters('the_tags',$tagpost->name); | |
$keyword = utf8_decode($mymetatag); // Your filters... | |
echo $keyword.","; | |
} | |
} | |
?>" /> |
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
.form-input input, .form-input textarea { display: block; width: 100%; padding: 0; border-width: 0; } | |
.form-input { border: 0; padding: 1vw; margin: 1vw; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } | |
.form-button { margin: 1vw; } | |
.form-input input { } | |
.form-input textarea { } | |
.form-box button { display: block; border: 0; padding: 1vw; width: 100%; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } |
NewerOlder