This file contains hidden or 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 | |
| /* | |
| Debug preview with custom fields | |
| Taken from: http://support.advancedcustomfields.com/forums/topic/preview-solution/ | |
| See also: http://support.advancedcustomfields.com/forums/topic/2nd-every-other-post-preview-throws-notice/ | |
| */ | |
| add_filter('_wp_post_revision_fields', 'add_field_debug_preview'); | |
| function add_field_debug_preview($fields){ | |
| $fields["debug_preview"] = "debug_preview"; | |
| return $fields; |
This file contains hidden or 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 | |
| /* | |
| * Tag Shortcode | |
| * Usage: [tag type="span" class="myClass" id="firstSpan"]Lorem ipsum dolor sit amet[/tag] | |
| */ | |
| function tag_shortcode( $atts, $content = null ) { | |
| extract( shortcode_atts( array( | |
| 'class' => 'shortcode_class', | |
| 'id' => '', | |
| 'type' => 'div', |
This file contains hidden or 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
| #views.py | |
| def events_index(request, year): | |
| selected_year = Year.objects.get(title=year) | |
| events_list = Event.objects.filter(year = selected_year.id).order_by('category','start_date') | |
| return render_to_response('events_list.html', {"events_list": events_list}) | |
| #events_list.html | |
| {% regroup events_list by category.title as events_list_by_category %} |
This file contains hidden or 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 | |
| $post_type = 'post'; | |
| // Get all the taxonomies for this post type | |
| $taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) ); | |
| foreach( $taxonomies as $taxonomy ){ | |
| // Gets every "category" (term) in this taxonomy to get the respective posts | |
| $terms = get_terms( $taxonomy ); | |
| foreach( $terms as $term ){ | |
| echo $term->name; | |
| } |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
| <title>Google Maps Multiple Markers</title> | |
| <script src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
| <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="map" style="width: 500px; height: 400px;"></div> |
This file contains hidden or 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 { Page } from '@playwright/test'; | |
| export async function waitForGraphQL( | |
| page: Page, | |
| operationName: string | |
| ): Promise<void> { | |
| await page.waitForResponse(async (response) => { | |
| if (response.url().endsWith('/graphql')) { | |
| const responseText = await response.text(); | |
| const responseData = JSON.parse(responseText); |
This file contains hidden or 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
| /* | |
| Launch Darkly Context Provider using their JavaScript Client SDK | |
| This component is used to provide the feature flags context to the rest of the app. | |
| This is how you can use feature flags in your components: | |
| 1) Add your flag to the `Flags` constant in this file if it's not already there: | |
| myFlag: { slug: 'my-flag', defaultValue: false }, |
This file contains hidden or 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 | |
| // Update google map latitude/longitude after importing, using address | |
| // | |
| // https://support.advancedcustomfields.com/forums/topic/how-to-update-google-map-latitudelongitude-after-importing-using-address/ | |
| // https://gist.githubusercontent.com/RadGH/428bd8133c34dae60c0c/raw/fbfb0536abd1afc0fad1d2ed2b51c69304406c78/recalculate-acf-locations.php | |
| // | |
| // INSTRUCTIONS | |
| // 1. Grab the file from this Gist and upload it to your theme. | |
| // 2. Configure the options in the variable $ld_recalc. You MUST set the post type, and set the different field keys (see Finding the Field Key). | |
| // 3. Call the file at the top of your functions.php script using include "recalculate-acf-locations.php"; |
This file contains hidden or 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 keepVideoFromSkipping() { | |
| // modified from https://stackoverflow.com/a/39754847 | |
| function modifyBehavior(video) { | |
| var timeTracking = { | |
| watchedTime: 0, | |
| currentTime: 0 | |
| }; | |
| var lastUpdated = 'currentTime'; |
This file contains hidden or 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
| # Docker Compose for WordPress with Data Persistence | |
| # | |
| # Resources | |
| # https://medium.com/@tatemz/local-wordpress-development-with-docker-3-easy-steps-a7c375366b9 | |
| # https://hub.docker.com/_/wordpress/ | |
| # https://hub.docker.com/r/_/mariadb/ | |
| # https://stackoverflow.com/a/39208187/648844 | |
| # https://github.com/nezhar/wordpress-docker-compose | |
| # | |
| version: "2" |
NewerOlder