Home > custom post types > Is it possible to remove the word "date" from archives?

Is it possible to remove the word "date" from archives?

July 18Hits:1
Advertisement

I can't figure out how to remove the word "date from the permalink for yearly archives. For example:

[http://localhost/wordpress/news/date/2012]

On single news pages the permalink looks like this:

[http://localhost/wordpress/news/2012/news-article/]

I've created a custom post type called "News". The slug for this post_type is obviously "news". I've set 'archive' to true and 'with_front' to false.

I want a clean News Archive which can be broken down by years. I tried a different solution, but it posed problems. I set the 'archive' to false and created a News page with a custom template, for current News Articles. I then created child pages for each year's News Articles, but Wordpress added -2 to the permalink.. For example:

2012 = news/2012-2

I just want my permalinks to be like this:

news

news/2012

news/2012/news-item

I've tried a few plugins but nothing seems to work. Any Ideas?

Answers

go to Settings -> Permalinks tab

Try this:

/%category%/%year%/%postname%/

WordPress Answers showed me a related question that helped.

custom post types, wp_get_archives and add_rewrite_rule

I had to modify the code:

add_action('init', 'wpse50530_journal_archive_rewrite');
function wpse50530_journal_archive_rewrite(){
    add_rewrite_rule('^news/([0-9]{4})/?','index.php?post_type=news&year=$matches[1]','top');
}

Related Articles

  • Is it possible to remove the word "date" from archives?July 18

    I can't figure out how to remove the word "date from the permalink for yearly archives. For example: [http://localhost/wordpress/news/date/2012] On single news pages the permalink looks like this: [http://localhost/wordpress/news/2012/news-article/]

  • Trying to remove hard coded data from a function in PHPFebruary 5

    I'm trying to make my function more versatile by removing hard coded data. function get_currency_rate($currencySource) { if (isset($currencySource)) { $feed = $currencySource; } else { echo 'Feed not found. Check URL'; } if (!$feed) { echo('Feed not

  • How I can remove all Google data from Youtube video downloads?November 10

    Just now I am reading one question here that Google is tracking all Youtube video's. In video files I am seeing this- Same file 2 times General Complete name : Video1.flv Format : Flash Video httphostheader : o-o---preferred---sn-huoa-qxae---v6---lsc

  • how to remove fieldset from date input

    how to remove fieldset from date inputDecember 14

    I set up a site in drupal, and I need to show the fields of date type in the same way as other fields. the problem is that those fields are inside a fieldset. I'm try the solution code karate, buts it only changes the fieldset to a label. What I want

  • How can I remove my personal data from my PGP public key?July 24

    According to this Q&A-discussion it is possible to remove all personal data (name and mail address) that is attached to a public key. What steps do I have to follow in order to remove all personal data? Will that modified public key still allow me to

  • How can i remove firefox user data folder from ubuntu 13.04?September 15

    How can i remove firefox user data folder from ubuntu 13.04? My firefox is too slow whenever it get slows on my other operating system i just simply remove userdata folder but how can i remove from ubuntu 13.04? --------------Solutions------------- Y

  • Trying to remove leftover GPT Data using Fixparts

    Trying to remove leftover GPT Data using FixpartsJanuary 5

    So i have a laptop that come with windows 8, like others i dislike it with passion, installed windows 7 over the top (i assumed it would atleast wipe the MBR properly but i dont think so anymore. anyway this is my partition setup (according to the MB

  • Remove all duplicate data in mysqlJuly 3

    I want remove all duplicate data from my table. anyone help me. my table : biblio one one two three three four five i want to get result like this biblio two four five --------------Solutions------------- Given this table mysql> USE test Database cha

  • How to remove the no data area (sea) from a raster in arcmap?

    How to remove the no data area (sea) from a raster in arcmap?October 9

    I have some difficulties removing the no data part from a Geotif SRTM . I need to remove all sea part. Im new in arcgis and, help is appreciated. Thanks There you go Sir This is the result i wanted --------------Solutions------------- If you go to Sy

  • Programatically remove "custom xml data" from Office docs in SP?April 23

    In Word 2013, if you open a document there's an option to "Check for Issues" and this gives you the option to remove custom XML data. Is there a way to achieve this programmatically with powershell? My issue is that we have a set of document lib

  • Removing App doesn't remove App Group dataFebruary 12

    Ever since I started using App Groups to share Core Data between my App and a Today Extension/Widget I am having an issue. When I delete my app the core data maintains on the device, instead of being deleted like it used to. I am aware this question

  • What medium should be used for long term, high volume, data storage (archival)?

    What medium should be used for long term, high volume, data storage (archival)?January 4

    This question was inspired by http://superuser.com/questions/374386/how-to-store-and-preserve-lots-of-data. There have been other similar questions, but none with the same criteria. This is two questions in one. How do you store financial/critical re

  • Disable date based archives for all categories except oneOctober 4

    I want to remove all date base archive url permalinks (url_rewrites) from my site, excluding for only 1 category. How can i do that. For example: www.example.com/category_1/2012/ -> 404 error www.example.com/category_2/2012/ -> 404 error but: www.ex

  • just can't get date-based archives per post-type to workFebruary 25

    I expected that wp3.1 with the support for archive-{post_type}.php would solve my problems. However, I am still struggling to get it working. What I want is: a custom date-based archive page per post-type, which displays years and months. Once you cl

  • Custom Post Type Date Based Archive URL rewrite May 8

    Possible Duplicate: custom post types, wp_get_archives and add_rewrite_rule I have a custom post type called "course" and I would like to create a date based archive similar to the default post archives which look like mysite.com/2012/05. I want

  • Display Jalali (Shamsi) Date in Archive ViewApril 19

    I have a Persian language website and I need to a archive block in my site. but date of default archive view is Gregorian. I install Datex module and it convert all date of nodes to Jalali(Shamsi) Date but can't convert Gregorian date to Jalali Date

  • How to determine consumption of data for archiving in sql server?May 6

    I was told that it could be possible to analyze the consumption of a given row. I already know I can use sys.dm_db_index_usage_stats to see the reads / writes on a given index (thus the table) but I need to know for the row level. For example: The in

  • How do you remove/disable Evolution Data Server processJuly 29

    I want to stop evolution-data-server-2.24 from loading at startup. I tried to uninstall all evolution related items, but I got some nasty warnings about removing the data server so I left it installed. There are no items in my startup list that look

  • How to remove the meta data of all files within a folder and it's sub folders?

    How to remove the meta data of all files within a folder and it's sub folders?July 7

    When a right click a file and hit details, it shows me Date created, date modified, owner, and computer. I have a folder that I want to send to someone. Basically I want to remove the Date created, date modified, owner, and computer info (and other m

  • How to remove Mail.app data after opening it to configure it to not open in the future?

    How to remove Mail.app data after opening it to configure it to not open in the future?July 11

    Sorry about the title. I followed these answers as suggested by some users on Ask Different. They've solved my problem. However, when I opened up Mail.app to inform it I want to use Google Notifier as default, like so, in the time it took to do this

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.454 s.