Skip to content

Instantly share code, notes, and snippets.

@Nahuai
Last active June 11, 2020 17:53
Show Gist options
  • Save Nahuai/96577e8a2ee82286782a64815828bb83 to your computer and use it in GitHub Desktop.
Save Nahuai/96577e8a2ee82286782a64815828bb83 to your computer and use it in GitHub Desktop.
Block Template - Los Mundos de Celi
<?php
/* Template block para las entradas de Los Mundos de Celi */
add_action( 'register_post_type_args', 'cg_post_block_template', 20, 2 );
function cg_post_block_template( $args, $post_type ) {
$block_route_list = new WP_Query(
[
'post_type' => 'wp_block',
'title' => 'lista-ruta',
]
);
$block_bring_list = new WP_Query(
[
'post_type' => 'wp_block',
'title' => 'lista-llevar',
]
);
$block_links = new WP_Query(
[
'post_type' => 'wp_block',
'title' => 'links',
]
);
if ( 'post' === $post_type) {
$args[ 'template' ] = [
[
'core/paragraph', [
'placeholder' => __( 'Intro', 'imagely-ansel' )
]
],
[
'core/html', [
'content' => __( '[toc]', 'imagely-ansel' )
]
],
[
'core/heading', [
'level' => 2,
'content' => __( 'Características técnicas', 'imagely-ansel' )
]
],
[ 'core/block', [
'ref' => $block_route_list->posts[0]->ID,
]
],
[
'core/heading', [
'level' => 2,
'placeholder' => __( 'De un sitio chulo', 'imagely-ansel' )
]
],
[
'core/heading', [
'level' => 2,
'content' => __( 'Qué llevar', 'imagely-ansel' )
]
],
[ 'core/block', [
'ref' => $block_bring_list->posts[0]->ID,
]
],
[
'core/heading', [
'level' => 2,
'content' => __( 'Dónde dormir', 'imagely-ansel' )
]
],
[
'core/heading', [
'level' => 2,
'content' => __( 'Dónde comer', 'imagely-ansel' )
]
],
[
'core/heading', [
'level' => 2,
'content' => __( 'Presupuesto de la excursión', 'imagely-ansel' )
]
],
[
'core/heading', [
'level' => 2,
'content' => __( 'Links de utilidad', 'imagely-ansel' )
]
],
[ 'core/block', [
'ref' => $block_links->posts[0]->ID,
]
],
[
'core/paragraph', [
'content' => __( '¿Prefieres que un guía local que te ayude a organizar tu viaje a la Costa Amalfitana?', 'imagely-ansel' )
]
],
[
'core/paragraph', [
'content' => __( 'Entonces, echa un vistazo a&nbsp;<a href="https://clk.tradedoubler.com/click?p=297364&amp;a=3095930&amp;g=24531114&amp;url=https://www.evaneos.es/italia/viajes/destinos/1730-amalfi/" target="_blank" rel="noreferrer noopener" aria-label=" (abre en una nueva pestaña)">las ofertas de Evaneos</a>&nbsp;en Italia.', 'imagely-ansel' )
]
],
[
'core/heading', [
'level' => 2,
'content' => __( 'Mapa', 'imagely-ansel' )
]
],
[
'core/html', [
'placeholder' => __( '', 'imagely-ansel' )
]
],
];
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment