Skip to content

Instantly share code, notes, and snippets.

View lawrencebrown's full-sized avatar
💭
Pizza

Lawrence Brown lawrencebrown

💭
Pizza
View GitHub Profile
@lawrencebrown
lawrencebrown / get_edit_post_link.php
Created April 8, 2020 06:32
Used at the bottom of posts for logged in users to edit
<?php if ( get_edit_post_link() ) : ?>
<footer class="entry-footer">
<?php
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit <span class="screen-reader-text">%s</span>', 'larryworld' ),
array(
'span' => array(
@lawrencebrown
lawrencebrown / the-content-wp-linlk-pages.php
Created April 8, 2020 05:52
Wordpress the_content filed, page links at bottom of post
<div class="entry-content">
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'larryworld' ),
'after' => '</div>',
) );
?>
</div>
@lawrencebrown
lawrencebrown / gets-array-and-echo.php
Last active March 21, 2020 18:47
Gets the_field and stores its arrays, then echo inserts them using square brackets.
<?php $button = get_field('name_of_field'); ?>
<a href="<?php echo $button['url']; ?>"
target="<?php echo $button['target']; ?>">
<?php echo $button['title']; ?>
</a>
<?php
echo '<pre>';
print_r(get_field('name_of_field'));
echo '</pre>';
die();
?>
@lawrencebrown
lawrencebrown / New Mac Terminal Preference Changes
Created May 29, 2018 11:13
Useful stuff for customising mac
<-- Turns off bouncing applications in the dock -->
defaults write com.apple.dock no-bouncing -bool TRUE;
killall Dock
<-- Change location of Screenshots folder - drag location from finder after the word location -->
defaults write com.apple.screencapture location
killall SystemUIServer
Renaming a mac user
----
sudo scutil --set ComputerName "newname"
sudo scutil --set LocalHostName "newname"
sudo scutil --set HostName "newname"
Then: Flush the DNS cache by typing: dscacheutil -flushcache
Then: Restart your Mac
-
DONE
<script type="text/javascript">
jQuery('iframe.vimeo').each(function(){
Froogaloop(this).addEvent('ready', ready);
});
function ready(playerID){
Froogaloop(playerID).addEvent('play', function(data) {play(playerID);});
}
function play(playerID){
alert(playerID + " is playing!!!");
<script type="text/javascript">
$(document).ready(function() {
$('body').css('display', 'none');
$('body').fadeIn(300);
$('a').click(function() {
event.preventDefault();
newLocation = this.href;
$('body').fadeOut(300, newpage);
});
function newpage() {
var adjustMenu = function() {
if (ww < 768) {
$(".toggleMenu").css("display", "inline-block");
if (!$(".toggleMenu").hasClass("active")) {
$(".nav").hide();
} else {
$(".nav").show();
}
$(".nav li").unbind('mouseenter mouseleave');
$(".nav li a.parent").unbind('click').bind('click', function(e) {
<div class="pinterest">
<a href="http://pinterest.com/pin/create/button/?url={{ shop.url }}{{ product.url }}&media={{ product.featured_image | product_img_url: 'large' }}" class="pin-it-button" count-layout="horizontal">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
</div>