wpcasa
wpcasa copied to clipboard
Decouple backend archive list and the frontend archive list
I recognised that the list of listings in the backend is using the frontend template listing-archive.php. In my opinion this isn't a good way to handle the backend list.
For example I've changed the display of the image: I putt the correct image as a css background image to prepare it a little bit against copy and download. So I have the following snippet for the listing image:
<?php
$post = get_post();
$imageAlt = get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'blog-startpage' );
?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php if ( has_post_thumbnail() && $image) : ?>
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" width="<?php echo $image[1] ?>" height="<?php echo $image[2] ?>" style="background: url(<?php echo $image[0] ?>); background-size: cover;" alt="<?php echo $imageAlt ?>" class="img-fluid" />
<?php else: ?>
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="img-fluid" />
<?php endif ?>
</a>
Now, in the backend the a tag around the image has the href https://domain.de/wp-admin/%3C?php%20the_permalink();%20?%3E. That's not so cool... 🙁