the_post()
should be called at the start of the while
loop (or The Loop). I.e. Before you call functions like the_permalink()
and the_title()
which point to the current item in The Loop.
So your while
loop should start like so: (and remove the other the_post();
in your code)
while ( have_posts() ) : the_post();
And the browser sent you to about:blank#blocked
most likely because the a
element had an invalid href
(URL) value: https://
as in:
<a href="https://">Example</a>
And it’s very likely because the get_field('website')
returned an empty value; for example, because of a wrong post data (ID/object).
So this part:
if (is_post_type_archive( $resources )) {
echo 'https://' . get_field('website');
}
could be rewritten to this:
if (is_post_type_archive( $resources )) {
if ( $url = get_field('website') ) {
echo 'https://' . $url;
} else {
the_permalink();
}
}
But I’m assuming the website
field doesn’t start with the protocol (e.g. https://
or http://
).
And there’s no need to echo the_permalink()
because the function already echoes the permalink/URL.