Skip to content

Instantly share code, notes, and snippets.

@wpsoul
Created November 13, 2023 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpsoul/8b07f63aaa770fae2bdbd301f1d29ee1 to your computer and use it in GitHub Desktop.
Save wpsoul/8b07f63aaa770fae2bdbd301f1d29ee1 to your computer and use it in GitHub Desktop.
Dynamic Accordion for Greenshift wordpress and repeatable field
<!-- wp:greenshift-blocks/repeater {"id":"gsbp-7c7bd810-389b","inlineCssStyles":null,"border":{"borderRadius":{"values":{},"locked":true}},"columnGrid":[1,3,2,1],"dynamicField":"accordion","post_type":"post"} -->
<!-- wp:greenshift-blocks/container {"id":"gsbp-f334cf9e-4e11","inlineCssStyles":null,"border":{"borderRadius":{"values":{"topLeft":["6px"],"topRight":["6px"],"bottomRight":["6px"],"bottomLeft":["6px"]},"locked":true},"style":{"all":["solid"]},"size":{"all":[1]},"color":{"all":["var(\u002d\u002dwp\u002d\u002dpreset\u002d\u002dcolor\u002d\u002dlightgrey, #A8B8CD)"]},"styleHover":{},"sizeHover":{},"colorHover":{}},"className":"qawrap"} -->
<div class="wp-block-greenshift-blocks-container gspb_container gspb_container-gsbp-f334cf9e-4e11 qawrap" id="gspb_container-id-gsbp-f334cf9e-4e11"><!-- wp:greenshift-blocks/container {"id":"gsbp-3cc4d512-15df","inlineCssStyles":null,"dynamicGClasses":[{"value":"qaquestion","type":"local","label":"qaquestion","localed":false,"css":"","attributes":{},"originalID":"gsbp-3cc4d512-15df","originalBlock":"greenshift-blocks/container","selectors":[{"value":".active .qaicon","attributes":{"csstransform":{"rotateZ":["90"],"time":0.5}},"css":"body .qaquestion.active .qaicon{transition:all 0.5s cubic-bezier(0.165,0.84,0.44,1);transform: rotateZ(90deg);}"},{"value":" .qaicon","attributes":{"csstransform":{"time":"0.5"}},"css":"body .qaquestion .qaicon{transition:all 0.5s cubic-bezier(0.165,0.84,0.44,1);}"}]}],"interactionLayers":[{"triggerData":{"trigger":"click"},"actions":[{"actionname":"toggle-class","env":"no-action","classname":"active"},{"actionname":"toggle-class","env":"no-action","classname":"active","selector":"{CLOSEST:.qawrap}{SELECTOR_ALL:.qaanswer }","cssSelectorBuilder":[{"combinator":"","selector":".qaanswer","complexselector":"","pseudoclass":""}],"jsSelectorBuilder":{"closest":true,"closestSelector":".qawraper"}}],"env":"no-action"}],"flexbox":{"flexDirection":["row"],"type":"flexbox","justifyContent":["space-between"],"alignItems":["center"]},"spacing":{"margin":{"values":{},"locked":false},"padding":{"values":{"top":["10px"],"right":["20px"],"bottom":["10px"],"left":["20px"]},"locked":false}},"typography":{"textShadow":{},"customcursor":"pointer"},"className":"qaquestion"} -->
<div class="wp-block-greenshift-blocks-container gspb_container gspb_container-gsbp-3cc4d512-15df qaquestion" id="gspb_container-id-gsbp-3cc4d512-15df" data-gspbactions="[{&quot;triggerData&quot;:{&quot;trigger&quot;:&quot;click&quot;},&quot;actions&quot;:[{&quot;actionname&quot;:&quot;toggle-class&quot;,&quot;env&quot;:&quot;no-action&quot;,&quot;classname&quot;:&quot;active&quot;},{&quot;actionname&quot;:&quot;toggle-class&quot;,&quot;env&quot;:&quot;no-action&quot;,&quot;classname&quot;:&quot;active&quot;,&quot;selector&quot;:&quot;{CLOSEST:.qawrap}{SELECTOR_ALL:.qaanswer }&quot;,&quot;cssSelectorBuilder&quot;:[{&quot;combinator&quot;:&quot;&quot;,&quot;selector&quot;:&quot;.qaanswer&quot;,&quot;complexselector&quot;:&quot;&quot;,&quot;pseudoclass&quot;:&quot;&quot;}],&quot;jsSelectorBuilder&quot;:{&quot;closest&quot;:true,&quot;closestSelector&quot;:&quot;.qawraper&quot;}}],&quot;env&quot;:&quot;no-action&quot;}]"><!-- wp:greenshift-blocks/meta {"id":"gsbp-879ebb95-0aa6","inlineCssStyles":null,"typographyValue":{"textShadow":{},"size":["18px"],"customweight":"bold"},"type":"repeater","typeselect":"repeater","repeaterField":"question"} /-->
<!-- wp:greenshift-blocks/iconbox {"id":"gsbp-7847de96-b836","inlineCssStyles":null,"dynamicGClasses":[{"value":"qaicon","type":"local","label":"qaicon","localed":false,"css":"","attributes":{},"originalID":"gsbp-7847de96-b836","originalBlock":"greenshift-blocks/iconbox","selectors":[]}],"iconBox_icon":{"icon":{"font":"rhicon rhi-angle-right","svg":"","image":""},"fill":"currentColor","fillhover":"","type":"font","iconSizeY":["20px"],"iconSize":["20px"]},"className":"qaicon"} -->
<div class="wp-block-greenshift-blocks-iconbox gspb_iconBox gspb_iconBox-id-gsbp-7847de96-b836 qaicon" id="gspb_iconBox-id-gsbp-7847de96-b836"><div class="gspb_iconBox__wrapper" style="display:inline-flex"><svg class="" style="display:inline-block;vertical-align:middle" width="72" height="72" viewBox="0 0 384 1024" xmlns="http://www.w3.org/2000/svg"><path style="fill:#565D66" d="M375.6 529l-293.6 296c-9.4 9.4-24.6 9.4-34 0l-39.6-39.6c-9.4-9.4-9.4-24.6 0-34l237-239.4-237-239.4c-9.4-9.4-9.4-24.6 0-34l39.6-39.6c9.4-9.4 24.6-9.4 34 0l293.6 296c9.4 9.4 9.4 24.6 0 34z"></path></svg></div></div>
<!-- /wp:greenshift-blocks/iconbox --></div>
<!-- /wp:greenshift-blocks/container -->
<!-- wp:greenshift-blocks/container {"id":"gsbp-33b96a24-3740","inlineCssStyles":null,"dynamicGClasses":[{"value":"qaanswer","type":"local","label":"qaanswer","localed":false,"css":"body .qaanswer{overflow:hidden;}body .qaanswer{transition:all 0.2s ease-in-out;}body .qaanswer{max-height:0px;}","attributes":{"size":{"customWidth":{"value":[]},"customHeight":{"value":[]},"heightType":"custom","maxHeight":["0px"]},"spacing":{"margin":{"values":{},"locked":false},"padding":{"values":{},"locked":false},"overflow":["hidden"]},"csstransform":{"time":"0.2","easing":"ease-in-out"}},"originalID":"gsbp-33b96a24-3740","originalBlock":"greenshift-blocks/container","selectors":[{"value":".active","attributes":{"size":{"customWidth":{"value":[]},"customHeight":{"value":[]},"heightType":"custom","maxHeight":["1000px"]},"csstransform":{"time":"0.5","easing":"ease-in-out"}},"css":"body .qaanswer.active{transition:all 0.5s ease-in-out;}body .qaanswer.active{max-height:1000px;}"}]}],"className":"qaanswer"} -->
<div class="wp-block-greenshift-blocks-container gspb_container gspb_container-gsbp-33b96a24-3740 qaanswer" id="gspb_container-id-gsbp-33b96a24-3740"><!-- wp:greenshift-blocks/meta {"id":"gsbp-6ee3bda8-9166","inlineCssStyles":null,"spacing":{"margin":{"values":{},"locked":false},"padding":{"values":{"top":["10px"],"bottom":["10px"],"right":["20px"],"left":["20px"]},"locked":false}},"border":{"borderRadius":{"values":{},"locked":true},"style":{"top":["solid"]},"size":{"top":[1]},"color":{"top":["var(\u002d\u002dwp\u002d\u002dpreset\u002d\u002dcolor\u002d\u002dlightgrey, #A8B8CD)"]},"styleHover":{},"sizeHover":{},"colorHover":{}},"typographyValue":{"textShadow":{},"size":["17px"]},"type":"repeater","typeselect":"repeater","repeaterField":"answer"} /--></div>
<!-- /wp:greenshift-blocks/container --></div>
<!-- /wp:greenshift-blocks/container -->
<!-- /wp:greenshift-blocks/repeater -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment