1

I tried many different solutions to get category page for wordpress to work. Here are my settings in wordpress.enter image description here

I like to have structure "domainname.com/name of the post/" but when I want to go to individual category page I receive an error that it doesn't exist.

If I change permalink structure from /%postname%/ to /%postname%/%category%/ everything works fine but the structure of the post is domainname.com/category/name of the post/ and I don't want that. mydomain.com/health/ doesn't work if I keep the name of the post only. It works when I change it to /%postname%/%category%/

I tried to remove . in base category and it doesn't make any difference.

These are my entries in function.php

    <?php
function comment_reply_text( $link ) {
$link = str_replace( 'Reply', 'Odgovori', $link );
return $link;
}
add_filter( 'comment_reply_link', 'comment_reply_text' );
?>
<?php
function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
    $first_img = "/images/default.jpg";
  }
  return $first_img;
}
?>
<?php
function wpsites_query( $query ) {
if ( $query->is_home() && $query->is_main_query() ) { 
$query->set( 'posts_per_page', 10 ); }
}
add_action( 'pre_get_posts', 'wpsites_query' );
?>
<?php
function custom_excerpt($word_count_limit) {
    $content = wp_strip_all_tags(get_the_content() , true );
    echo wp_trim_words($content, $word_count_limit);
}
?>
<?php
add_filter( 'term_link', function($termlink){ return str_replace('/./', '.', $termlink); }, 10, 1 );
?>

Any ideas?

1 Answer 1

0

I don't think you can use a period in the category base field. If you are looking to remove the category base completely there is a plugin for that - https://wordpress.org/plugins/remove-category-base-littlebizzy/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.