how to change single post link

On the WP Dashboard, navigate to: Posts => Categories Create new Category, name it – Products. Then go to your post/product-a, on the right panel search for categories and add the new category Products to the post/product. Save it or Update the post, refresh the page, now if you check the url for this post, … Read more

List posts of assigned categories in list of all categories on single.php

Solved it with following code. My idea posted above worked out, but I had to rearrange the assigned categories in a new array. <ul> <?php $cargs = array( ‘type’ => ‘post’, ‘child_of’ => 0, ‘parent’ => ”, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 0, ‘hierarchical’ => 1, ‘exclude’ => ‘1’, ‘include’ => ”, … Read more

How to set class to “current-page” on the currently viewed single post within a CPT

I figured it out. Before the declaration of $case_query, I declare the active page id, like so: $active_page = get_the_ID();. Then, in the while loop after the_post(); I add the following: $activeclass=””; if (get_the_ID() === $active_page) { $activeclass=”current-page”; } I also add the $activeclass to the .case-list-item div: <div class=”case-list-item <?php echo $activeclass; ?>”> Solved.

Load next post by ID on a single page

It seems that I found a solution to this and it is pretty easy. So I’m gonna post all the code for future uses: single.php <?php get_header(); ?> <?php $post = get_post(); $post_cat = get_the_category($post); $data = collection_data_json($post_cat[0]->term_id, $post->ID); $data_details = collection_order_permalink($data); $author_id = intval($post->post_author); ?> <script type=”text/javascript”> var cat = “<?php print $post_cat_id ?>”; … Read more

Only show related posts when another post has same term

You can and should do it in a more simple way: In this example you can see the $tags variable, it get the tags of the post compare them and shows 7 posts (the showposts parameter) also makes sure that it won’t show the original post (post__not_in parameter). <?php // related posts based on first … Read more

Get the category of post

Just realised what the problem is, the code should basically be: <?php $catergory = get_the_category(); ?> <?php echo $catergory[0]->name; ?> I think the different versions of PHP from localhost / server were different which is why it was working on one but not the other (feel free to correct me if I’m wrong)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)