Placeres i functions.php
// Move Yoast to bottom function yoastToBottom() { return 'low'; } add_filter( 'wpseo_metabox_prio', 'yoastToBottom');
Placeres i functions.php
// Move Yoast to bottom function yoastToBottom() { return 'low'; } add_filter( 'wpseo_metabox_prio', 'yoastToBottom');
Docker desktop skal være installeret og startet.
Config filen placeres i roden af projektet. Webroot: web, er til bedrock setup.
Tilføj dev domæne i hosts filen på 127.0.0.1 (sudo nano /etc/hosts)
Kør lando start i terminalen
// .lando.yml name: projektnavn recipe: lamp config: webroot: web php: '5.6' database: mysql proxy: appserver: - domain.local (for https use domain.lndo.site)
Docs: https://docs.devwithlando.io/tutorials/lamp.html
Nedenstående eksempel tilføjer et filter som kan bruges i twig templaten sådan:
{{ field.name | truncate_title }}
add_filter('get_twig', 'add_to_twig'); function add_to_twig($twig) { $twig->addFilter('truncate_title', new Twig_Filter_Function('truncate_title')); return $twig; } function truncate_title($content) { $content = Timber\TextHelper::trim_characters($content, 45); return $content; }
The default menu items has the following positions:
Tekst tutorial i to dele.
BEMÆRK!! InspectorControls og ColorPalette skal importeres fra wp.editor, fremfor wp.blocks
Part 1:
Part 2:
Bruges for at vise billeder fra live server på lokalt setup.
# BEGIN Clever hack to show production images on dev site # Force image styles that have local files that exist to be generated. RewriteCond %{REQUEST_URI} ^/app/uploads/.*$ RewriteCond %{DOCUMENT_ROOT}/app/uploads/%1 -f RewriteRule ^(.*)$ $1 [QSA,L] # Otherwise, send anything else that's in the files directory to the production server. RewriteCond %{REQUEST_URI} ^/app/uploads/.*$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ http://yourdomain.com/$1 [QSA,L] # END Clever hack to show production images on dev site
WordPress REST API plugin V2
<?php function my_remove_default_et_pb_custom_search() { remove_action( 'pre_get_posts', 'et_pb_custom_search' ); add_action( 'pre_get_posts', 'my_et_pb_custom_search' ); } add_action( 'wp_loaded', 'my_remove_default_et_pb_custom_search' ); function my_et_pb_custom_search( $query = false ) { if ( is_admin() || ! is_a( $query, 'WP_Query' ) || ! $query->is_search ) { return; } if ( isset( $_GET['et_pb_searchform_submit'] ) ) { $postTypes = array(); if ( ! isset($_GET['et_pb_include_posts'] ) && ! isset( $_GET['et_pb_include_pages'] ) ) $postTypes = array( 'post' ); if ( isset( $_GET['et_pb_include_pages'] ) ) $postTypes = array( 'page' ); if ( isset( $_GET['et_pb_include_posts'] ) ) $postTypes[] = 'post'; /* BEGIN Add custom post types */ $postTypes[] = 'product'; /* END Add custom post types */ $query->set( 'post_type', $postTypes ); if ( ! empty( $_GET['et_pb_search_cat'] ) ) { $categories_array = explode( ',', $_GET['et_pb_search_cat'] ); $query->set( 'category__not_in', $categories_array ); } if ( isset( $_GET['et-posts-count'] ) ) { $query->set( 'posts_per_page', (int) $_GET['et-posts-count'] ); } } }
<span class="pl-k">require_once</span> ( plugin_dir_path(<span class="pl-c1">__FILE__</span>) <span class="pl-k">.</span> <span class="pl-s"><span class="pl-pds">'</span>wp-job-cpt.php<span class="pl-pds">'</span></span> );
Dette viser alle tilgængelige taxonomy terms og ikke kun de valgte. (Alle dem som er i brug på en post). Er der mere end 1, adskilles de med en skråstreg.
<?php $terms = get_terms("custom_taxonomy_navn"); $count = count($terms); $i = 0; if ( $count > 0 ){ foreach ( $terms as $term ) { if ( $i == 0) { echo $term->name; } else { echo " / " . $term->name; } $i++; } } ?>