Save Custom CSS file in the upload folder dynamically?

Please use this method: // Lets create some test CSS code $css=”/* Some test CSS */ body {background:red;}”; // Stash CSS in uploads directory require_once( ABSPATH . ‘wp-admin/includes/file.php’ ); // We will probably need to load this file global $wp_filesystem; $upload_dir = wp_upload_dir(); // Grab uploads folder array $dir = trailingslashit( $upload_dir[‘basedir’] ) . ‘some-folder/’; … Read more

adding class to excerpt

the_excerpt() function bascially echo(es) the get_the_excerpt() function output, which in turns wraps the $post->post_excerpt value in html <p> tags. So you can either strip the html markup, <p class=”myclass”><?= wp_strip_all_tags( get_the_excerpt(), true ) ?></p> or, if you have access to the $post object simply, <p class=”myclass”><?= $post->post_excerpt ?></p>

Header not properly displaying on archive.php

You forgot to add get_header() , please try below code. <?php get_header(); ?> <div class=”container”> <h1><?php single_cat_title();?></h1> <?php if (have_posts()) : while(have_posts()) : the_post();?> <div class=”card mb-4″> <div class=”card-body”> <?php if (has_post_thumbnail()):?> <img src=”<?php the_post_thumbnail_url(‘smallest’);?>” class=”img-fluid”> <?php endif;?> <h3><?php the_title();?></h3> <?php the_excerpt();?> <a href=”<?php the_permalink();?>” class=”btn btn-success”>Read more</a> </div> </div> <?php endwhile; endif;?> </div> <?php … Read more