Skip to content

Instantly share code, notes, and snippets.

@rishitells
rishitells / Jest_GitLab_CI.md
Last active May 3, 2024 20:18
Setting up Jest tests and coverage in GitLab CI

Configuring Jest Tests in GitLab CI

1. Add GitLab CI configuration file in the root

In the root of your project, add .gitlab-ci.yml with the configuration below.

image: node:latest

stages:
@jetsloth
jetsloth / gppa_input_image_choices.php
Created October 27, 2020 22:34
Filter Gravity Wiz Populate Anything to add Image Choices from post featured image
<?php
add_filter( "gppa_input_choices", "gppa_populate_featured_image_choices", 100, 3 );
function gppa_populate_featured_image_choices( $choices, $field, $objects ) {
if ( ! property_exists($field, 'imageChoices_enableImages') || ! $field->imageChoices_enableImages ) {
return $choices;
}
$i = 0;
export const GoogleApi = function(opts) {
opts = opts || {}
const apiKey = opts.apiKey;
const libraries = opts.libraries || [];
const client = opts.client;
const URL = 'https://maps.googleapis.com/maps/api/js';
const googleVersion = '3.22';
let script = null;
@crondeau
crondeau / chilpages-looping.php
Last active April 25, 2022 05:26
I used this code to loop through child pages of a custom post type called work. Each Work piece had a title, featured image and pdf. The child pages, describe the details of the project or work piece and display as an accordion. So basically what we have is an accordion within an accordion.
<?php
// loop through the sub-pages of your custom post type
$childpages = new WP_Query( array(
'post_type' => 'work',
'post_parent' => $this_page,
'posts_per_page' => 100,
'orderby' => 'menu_order'
));
while ( $childpages->have_posts() ) : $childpages->the_post(); ?>