Astilla VGR
Forum Replies Created
-
Thanks a lot for your help @joyously.
Why I try to create a content-xx.php file?
It is hard for me to create the html structure inside a php while. Im doing something that does not seems elegant at all for me ??while ( have_posts() ) : the_post(); /* * We remove the get_template_part() */ the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); echo "<h5>Fecha </h5>"; echo(types_render_field( "fecha", array("post_id"=>$my_post )) ); echo " </br><h5>Longitud</h5> "; echo types_render_field( "longitud"); echo " </br><h5>Circular / Ida y vuelta: </h5>"; echo types_render_field( "circular"); echo " <h5>Denivel acumulado: </h5>"; echo types_render_field( "desnivel-acumulado"); echo " </br><h5>Dificultad </h5>"; echo types_render_field( "dificultad"); endwhile;
So it sound good for me to call to another archive and make the html there.
The issue was that content-customtype.php also impact in custom type single view. Then I tried to create childtheme/template-parts/content-customtype2.php and call it using
get_template_part( 'template-parts/content-customtype2', get_post_format() );
But it does not works. What do you advise? Thanks in advance.
@joyously I have created the following doc:
childtemplate/template-parts/content-customtype.php
trying to override
template/template-parts/content-customtype.php
This is the function looking for this archive on archive-customtype.php
get_template_part( ‘template-parts/content’, get_post_format() );But it seems not working. I have read the documentation but i do not find the solution.
thanks in advance!
- This reply was modified 6 years ago by Astilla VGR.
Thanks a lot for the reply! Indeed the issue was not have the same folder structure.
The issue seems to be in the following function:
get_template_part( ‘template-parts/content’, get_post_format() );Should I modify it to make it read templates/childtemplate/content-programada.php?
I have found that the issue is the following:
File 1: templates/childtemplate/content-programada.php
File 2: templates/template/content.phpI expect to have File 1 (custom) layout, but I keep watching File 2 (original) layout.
Have i created the archive with the wrong name or in the wrong folder?