thetoolman123
Forum Replies Created
-
Thanks for the reply.
I see, is there not a way to link it to a URL? I’m sure I have done it before somehow?
It seemed to time out, so have uploaded it a different way ??
Forum: Developing with WordPress
In reply to: Blog posts only viewable by admin?I see, many thanks, yes it seems to work when logged out and only viewable by admin ??
Forum: Fixing WordPress
In reply to: Best way to protect content with login/register ability?Many thanks! I have decided to use the Simple Membership plugin which seems to do what I need.
Forum: Developing with WordPress
In reply to: Displaying 2 features postsCool, thanks for that. Yes it all works. I cheated a bit and asked Bard for the code! I’ve updated it to use the:
$args = [ 'category_name' => 'interviews', 'posts_per_page' => 1, ];
and that works perfectly! Thanks
Forum: Developing with WordPress
In reply to: Displaying 2 features postsI think I have worked it out. This is what I now have:
<?php // Get the category ID $category_id = get_cat_ID( 'interviews' ); // Get the arguments for the WP_Query $args = [ 'cat' => $category_id, 'posts_per_page' => 1, ]; // Create the WP_Query object $the_query = new WP_Query( $args ); // Loop through the posts while ( $the_query->have_posts() ) { $the_query->the_post(); } ?> HTML STUFF HERE <?php // Reset the postdata wp_reset_postdata(); ?>
Forum: Developing with WordPress
In reply to: Displaying 2 features postsThanks for the reply.
I am not sure if I have this correct as it didn’t seem to work.
This is now what I have:
<?php $category_id = get_cat_ID( 'competitions' ); $args = array( 'posts_per_page' => 1, 'cat' => $category_id, 'post__in' => get_option('sticky_posts'), ); ?> <?php $the_query = new WP_Query($args); $the_query = new WP_Query( 'posts_per_page=1' );?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); wp_reset_postdata();?> <?php $category_id = get_cat_ID( 'interviews' ); $argstwo = array( 'posts_per_page' => 1, 'cat' => $category_id, 'post__in' => get_option('sticky_posts'), ); ?> <?php $the_query = new WP_Query($argstwo); $the_query = new WP_Query( 'posts_per_page=1' );?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); wp_reset_postdata();?>
Forum: Developing with WordPress
In reply to: Adding a CSS file based on body_classI would probably have one main CCS file with the main stuff like UI stuff and then each page would have CSS relating just to that page rather than loading every single page’s CSS into one file
Forum: Developing with WordPress
In reply to: Limiting characters in $contentI managed to work it out by using:
<p><?php echo wp_trim_words( $content, 18, '...' ) ?></p>
Forum: Developing with WordPress
In reply to: How do I add custom fields to a post?I wasn’t using it at the time, but figured that may work
Forum: Developing with WordPress
In reply to: Displaying 2 features postsI see, so if I were to use
$args
and$argsTwo
for example, it should work?And the
wp_reset_postdata();
would go at the end of each query?Forum: Developing with WordPress
In reply to: How do I add custom fields to a post?I managed to sort it by adding this to the functions.php file:
add_filter('acf/settings/remove_wp_meta_box', '__return_false');
Forum: Developing with WordPress
In reply to: Displaying 2 features postsHi,
No they are assigned to individual categories.
1 is in Competitions and 1 is in Interviews
Forum: Developing with WordPress
In reply to: Which file do I add meta tags too?I found it, there was actually another header.php file so I added it there in the child theme and it’s worked.