Skip to content

Instantly share code, notes, and snippets.

View haveboard's full-sized avatar

haveboard haveboard

View GitHub Profile
@SubZane
SubZane / Asset.php
Created August 27, 2012 14:55
WordPress: get_attachment_id_from_src
function get_attachment_id_from_src ($src) {
global $wpdb;
$reg = "/-[0-9]+x[0-9]+?.(jpg|jpeg|png|gif)$/i";
$src1 = preg_replace($reg,'',$src);
if($src1 != $src){
$ext = pathinfo($src, PATHINFO_EXTENSION);
$src = $src1 . '.' .$ext;
}
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$src'";
$id = $wpdb->get_var($query);
import React, { Component } from 'react';
import './App.css';
const ShowingYourName = (props) => {
return (
<p>{props.firstName}</p>
)
}
class App extends Component {
@visualkom
visualkom / CSS Image Replacement
Last active December 5, 2019 15:58
[New CSS Image Replacement] (Jeffrey Zeldman blog post) #css
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@srikat
srikat / test.html
Created May 8, 2018 06:48
Dummy Content for Gutenberg
<!-- wp:heading -->
<h2>Heading Block (H2)</h2>
<!-- /wp:heading -->
<!-- wp:heading -->
<h3>You are looking at one. (H3)</h3>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>Subhead Block</h2>
@justincarroll
justincarroll / bootstrap-masonry-template.htm
Last active August 15, 2020 16:48
This is my template for using Masonry 3 with Bootstrap 3. For those of you who follow this gist a lot has changed since Bootstrap 2.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Masonry Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700">
@DWboutin
DWboutin / Merge wp_query
Created February 7, 2014 14:17
Merge 2 WP_Query()
<?php
$query1 = new WP_Query($arg1);
$query2 = new WP_Query($arg2);
$query = new WP_Query();
$query->posts = array_merge( $query1->posts, $query2->posts );
// we also need to set post count correctly so as to enable the looping
# Variables to replace in urls below
username = 'your_username_here_without_at_symbol'
key = 'public_key_from_dev'
application_token = 'very_long_application_token'
# This needs to be parsed as JSON for all of the 'id' fields. These are the board_hashes
url_for_board_hashes = "https://api.trello.com/1/members/#{username}/boards?&key=#{key}&token=#{application_token}"
#
# Loop over each board_hash and call the following url
@Integralist
Integralist / bootstrap.css
Created November 24, 2011 14:16
List of Twitter Bootstrap CSS classes
/*
* Scaffolding
* Basic and global styles for generating a grid system, structural layout, and page templates
* ------------------------------------------------------------------------------------------- */
.container
Sets a width of 940px which also centres the content (clears floated elements before/after)
.container-fluid
Sets a minimum width of 940px (clears floated elements before/after)
Add the following to your `functions.php`
```php
function vc_before_init_actions() {
require_once( get_template_directory().'/functions/shortcodes/vc-text-image.php' );
}
add_action( 'vc_before_init', 'vc_before_init_actions' );
```
And now create a file in the location specified above with the following (customise accordingly):