Skip to content

Instantly share code, notes, and snippets.

View wpfangirl's full-sized avatar

Sallie Goetsch wpfangirl

View GitHub Profile
@wpfangirl
wpfangirl / responsive-embeds.css
Last active August 24, 2024 19:29
Use oembed_dataparse to calculate padding for responsive embeds, with simplified CSS
/**
* Add to your stylesheet if it isn't there
*/
.wp-embed-responsive {
position:relative;
margin-bottom: 20px;
}
.wp-embed-responsive > iframe{
@wpfangirl
wpfangirl / template.html
Created January 15, 2022 01:38
Add a row to your block template
/* Adds the row block in an HTML template */
<!-- wp:group {"layout":{"type":"flex","allowOrientation":false}} -->
<div class="wp-block-group"></div>
<!-- /wp:group -->
@wpfangirl
wpfangirl / acf-blocks.css
Last active January 24, 2022 04:01
Code Examples for ACF Blocks
/* PDF Thumbnail Block */
.pdf-thumbnail {
margin-top: 1rem;
margin-bottom: 1.75rem;
}
.link-to-pdf img {
box-shadow: 2px 2px 5px rgba(53, 53, 47, 0.2);
}
@wpfangirl
wpfangirl / create-image.php
Created October 25, 2018 16:40
Set Gravity Forms upload as post thumbnail (featured image)
<?php
/**
* Create the image attachment and return the new media upload id.
*
* @author Joshua David Nelson, [email protected]
*
* @since 03.29.2017 updated to a class, utilizing code from Takuro Hishikawa's gist linked below.
*
* @see https://gist.github.com/hissy/7352933
*
@wpfangirl
wpfangirl / portfolio-block-template.php
Last active March 28, 2020 19:42
Add Gutenberg suport and a block template to an existing portfolio post type (e.g. from the Portfolio Post Type or Genesis Portfolio Pro plugin)
<?php
/**
* Adds block template to existing post type 'portfolio' with taxonomies 'portfolio_category' and 'portfolio_tag'.
*/
// Add Block Template to existing portfolio post type
function bbp_add_portfolio_template() {
$post_type_object = get_post_type_object( 'portfolio' );
$post_type_object->show_in_rest = true;
$post_type_object->rest_base = 'portfolio';
@wpfangirl
wpfangirl / functions.php
Created May 11, 2018 21:22
Show Custom Post Types in WordPress Dashboard "Recent Activity" Widget
<?php // Don't add the opening PHP tag. Instead, add this to your functionality plugin or at the end of functions.php.
//* Add All CPTs to "Recent Activity"
add_filter( 'dashboard_recent_posts_query_args', 'sinickas_dashboard_activity', 10, 1 );
function sinickas_dashboard_activity($query_args) {
$args = array(
// Excludes post types that don't show on the front end
'publicly_queryable' => true
);
$post_types = get_post_types($args);
@wpfangirl
wpfangirl / reposition-single-calendar-links.php
Created April 18, 2018 00:38
Relocate Modern Tribe Calendar Export Links Below Event Meta on Single Events
@wpfangirl
wpfangirl / event-functions-1.php
Last active March 16, 2022 15:34
Modify the Event Image Size with Filters (The Events Calendar)
// Change size of featured image on single events using post_thumbnail_size
add_filter( 'post_thumbnail_size', 'ebwp_single_event_post_thumbnail_size');
function ebwp_single_event_post_thumbnail_size($size) {
if( !is_singular('tribe_events') ) {
return;
}
if( ! has_post_thumbnail() ) {
return;
}
@wpfangirl
wpfangirl / 01-flex-defaults.html
Last active October 22, 2016 19:36
WCSAC 2016 Flexbox Files
<html>
<head>
<style>
body {
font-family: sans-serif;
font-size: 20px;
}
.flex-container {
border: 4px solid #09f;
height: 50vh;