Skip to content

Instantly share code, notes, and snippets.

for POST in $(wp post list --post_type=locations --post_parent=0 --format=ids); do wp post create --post_type=locations --post_parent=$POST --from-post=17717 --post_status=publish; done
@twentyfortysix
twentyfortysix / fetch_token.php
Last active March 5, 2021 14:21
heds up.. wp_remote_post, the Wordpress way
<?php
function get_POI_token($POI_URL_BASE, $POI_URL_TOKEN, $POI_PASS, $POI_USER, $POI_ID, $POI_SECRET){
// do your houseworks..
$url = $POI_URL_BASE.$POI_URL_TOKEN;
$username = $POI_USER;
$password = $POI_PASS;
$client_id = $POI_ID;
$client_secret = $POI_SECRET;
// some wanted url encoded
$args = array(
.delayer(@i) when (@i > 0) {
@t: ~":nth-child(@{i})";
li@{t} {
a{
transition: transform .6s ease-out @menu_speed+(@i * @menu_speed), opacity .6s ease-out @menu_speed + (@i * @menu_speed);
}
}
.delayer(@i - 1);
}
{{ fn('wpcf7_contact_form_tag_func', {'id':view.cform7_id, 'html_class':view.css_class}, null, 'contact-form-7') }}
@twentyfortysix
twentyfortysix / composer.json
Last active January 3, 2024 16:41
Wordpress Bedrock composer settings
{
"name": "roots/bedrock",
"type": "project",
"license": "MIT",
"description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
"homepage": "https://roots.io/bedrock/",
"authors": [
{
"name": "Scott Walkinshaw",
"email": "[email protected]",
@twentyfortysix
twentyfortysix / acf_meta_to_relation.php
Last active October 20, 2021 16:34
first function migrates the simple id to acf relation array, second cleans the data
<?php
function addMetaId2Relations($post_type, $meta_from, $meta_to){
$arr = [
'post_type' => $post_type,
'posts_per_page' => -1,
'fields' => 'ids'
];
$q = new WP_Query($arr);
echo 'poluted:<br><br>';
foreach ($q->posts as $id) {
wp db drop --yes && wp db import $(find db_backup/* -printf '%T+ %p\n' | sort -r | head -n 1)
#recover previous db backup, not last!
cd db_backup && wp db import "$(print -lr -- **/*(om[2,2]))"
@twentyfortysix
twentyfortysix / .htaccess
Last active January 16, 2023 16:18
manual web root to bedrock.sh
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.rocks$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.rocks$
RewriteCond %{REQUEST_URI} !bedrock/web/
RewriteRule (.*) /bedrock/web/$1 [L]
# or
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?domain.rocks$