the following warnings are present in logs after updating to php8.1.
PHP Warning: Undefined variable $q in .../accelerated-mobile-pages/templates/design-manager/design-1/archive.php on line 156
PHP Warning: Attempt to read property "max_num_pages" on null in .../accelerated-mobile-pages/templates/design-manager/design-1/archive.php on line 156
Here is a quick fix to check whether $q was set prior to access its properties.
--- archive.org.php 2022-10-11 09:41:26.222042154 +0200
+++ archive.php 2022-10-11 09:43:00.087727714 +0200
@@ -153,7 +153,7 @@
<div class="amp-wp-content pagination-holder">
<div id="pagination">
- <?php if ( get_next_posts_link('next', $q->max_num_pages) ){ ?><div class="next"><?php echo apply_filters('ampforwp_next_posts_link', get_next_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-next-text'], 'Next' ).'»', 0), $paged ) ?></div><?php }?>
+ <?php if ( isset($q) && get_next_posts_link('next', $q->max_num_pages) ){ ?><div class="next"><?php echo apply_filters('ampforwp_next_posts_link', get_next_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-next-text'], 'Next' ).'»', 0), $paged ) ?></div><?php }?>
<?php if ( get_previous_posts_link() ){ ?><div class="prev"><?php echo apply_filters( 'ampforwp_previous_posts_link', get_previous_posts_link( '« '. ampforwp_translation($redux_builder_amp['amp-translator-previous-text'], 'Previous' )), $paged ); ?></div><?php }?>
<div class="clearfix"></div>
</div>
Cheers!
]]>No matter what I do, I can’t create an archive-{content-type}.php page that seems to get picked up.
I have 2 pods that I created with the content type names of news and timeline.
I then selected the Enable Archive Page option.
I’ve created archive-news.php and archive-timeline.php but that page doesn’t come.
Thanks in advance!
]]>I’m using Pods for the first time and created a custom pod named News Stories.
In this pod, I’ve enabled Enable Archive Page and gave Archive Page Slug Override the value of news.
I assumed I could just create an archive-news-story.php file (tried archive-news.php and archive-news-stories.php) in the root of my theme but they don’t get picked up.
Help please!
]]>I have a custom product loop on my archive.php. Is it possible to add and use this filter to filter products in that loop? If so how? Thanks.
Here is example of my archive.php product loop:
// Setup your custom query
$loop = new WP_Query( array(
'post_type' => 'product',
'posts_per_page' => -1,
'post_status' => 'publish',
'tax_query' => array( array(
'taxonomy' => 'product_cat', // The taxonomy name
'field' => 'term_id', // Type of field ('term_id', 'slug', 'name' or 'term_taxonomy_id')
'terms' => $term->term_id, // can be an integer, a string or an array
) ),
) );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post();
the_post_thumbnail( 'thumbnail');
echo '<div style="margin:25px;">';
$step1 = get_field ( "example1" );
$step2 = get_field('example3', 'user_'.$step1 );
$data = array(
'foo' => 'bar',
'baz' => 'boom',
'cow' => 'milk',
'php' => 'hypertext processor'
);
$base_url = 'https://my-site.com/?page_id=1123/';
$query_params = http_build_query($data);
$link = $base_url . '?' . $query_params;
echo '<strong>';
echo '<a href = "' . $link . '">' .$step2. '</a>';
echo '</strong>';
echo '<br>';
$example2 = get_field ( "example2" );
echo '<a href="' .$destinationlink. '" target="_blank">';
the_title();
echo "</a>";
endwhile;
wp_reset_postdata(); // Remember to reset
endif; endif;
?>
]]>I am pretty new in WP theme development and maybe the answer to my question is quite simple… but I spent many hours looking for answer…
so, the problem is simple, I try to push my site using polylang to give me the year/year-and-month archive in secondary language.
The link for the primary language is: my-site/2020/04 and it’s working using archive.php, but if I switch to English that is secondary language with the link my-site/en/2020/04 it goes to index.php instead archive.php
How to fix that?
Best regards,
ZiemoT
I am creating a site using the neve theme. I have used CPT UI and Advanced Custom Fields to create a custom post type (equipment). I would like to be able to create a custom archive page for this such as “archive-equipment.php”.
I created a copy of the “archive-post.php” page found in the “wp-content/themes/neve/views” directory and named it “archive-equipment.php”.
I left it in the same directory.
When I make edits to “archive-equipment.php”, nothing happens to the archive page (mysite/equipment) for equipment. However, if I make changes to “archive-post.php”, the changes are seen on the archive page for equipment.
Does anyone know how I can get “archive-equipment.php” to control the equipment archive section on my website?
]]>How to customize the Blog entries for a custom post type?
It’s possible on other themes by archive.php file.
Thanks
]]>I have created an archive template and have applied it to my categories but I am getting the following error:
Fatal error: Uncaught Error: Call to undefined function generate_do_element_classes() in /nas/content/live/ablefuture/wp-content/themes/astra-child/archive.php:14 Stack trace: #0 /nas/content/live/ablefuture/wp-includes/template-loader.php(78): include() #1 /nas/content/live/ablefuture/wp-blog-header.php(19): require_once(‘/nas/content/li…’) #2 /nas/content/live/ablefuture/index.php(17): require(‘/nas/content/li…’) #3 {main} thrown in /nas/content/live/ablefuture/wp-content/themes/astra-child/archive.php on line 14
The site is experiencing technical difficulties.
Can anyone pls assist?
Thanks in advance
]]>is there no archive.php to display categories and tags in the theme?
I’d like a grid view with post names please? is there a function I can add in code snippets? Please help.