Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Montezuma Theme (http://forum.bytesforall.com/forumdisplay.php?f=53)
-   -   How do I remove date from front page, post pages? (http://forum.bytesforall.com/showthread.php?t=22780)

JimTrail Aug 31, 2014 04:41 PM

How do I remove date from front page, post pages?
 
Hello BytesForAll Forum!

Question 1: How do I remove the date from the front page and the post page?

Question 2: Could I use a child theme to remove the dates?

Here is the URL:
http://www.artantiquebroker.com/

I have got a couple of hacks that I put in the Edit CSS file. But I want to figure a better, more permanent fix. The display: none works okay for the front page. But whiting out the date on the post page is not a very good fix.

I might could figure out how to write a plugin but I was wondering if there might be an easier way to solve my problem?

PHP Code:

// Removes the date from the front page
div.post-date {
    
displaynone;
}

// Whites out the date on the post pages but the spaces are still there.
// I worry that this could also white out the category and tag links in some browsers.
div.post-footer {
    
color#FFFFFF;


I can find only one date remover plugin. It does not work. It removes the date from the front page but leaves spaces and an apostrophe. It does not work at all on the post pages.

Non-functional date remover plugin:
PHP Code:

<?php
/*
Plugin Name: WP Date Remover
Plugin URI: http://internetmarketinglab.net/internet-marketing-tools/wordpress-wp-post-date-remover
Description: (Wrong. Partly removes date from front page, does nothing for a post page. pn) This is a wordpress plugin that removes or hide date of a particular post or page in your wordpress blog.
Author: X Omar. (Nope. Doesn't work.)
Version: 1.0
Author URI: http://internetmarketinglab.net
*/

//remove date from
$locations = array('is_home','is_single','is_page');

//date functions used in your template
$date_functions = array('the_date''the_time','get_the_date''get_the_time');

//call date remover on loop start wordpress action
add_action('loop_start''date_remover');

//main date remover function
function date_remover()
{
    global 
$locations$date_functions;
    
    foreach(
$locations as $location)
    {
        if(
function_exists($location))
        {
            
remove_date($date_functions);
        }
    }
}

//remove date function
function remove_date($date_functions)
{
    foreach (
$date_functions as $date_function)
    {
        
add_filter($date_function'erase_date');
    }
}
//erase function
function erase_date(){}
#END OF PHP FILE

Thanks in advance. :)

juggledad Aug 31, 2014 07:45 PM

edit the sub template 'postformat.php'

JimTrail Sep 1, 2014 07:57 AM

Editing the postformat.php sub-template only removes the date from the front page. I already figured out how to do that.

This css snippet in the Edit CSS section removes the date from the front page.
div.post-date {
display: none;
}

You can't edit the date on the post pages from the postformat.php page.

I am trying to figure out a permanent fix so I don't lost all my changes when the theme updates.

juggledad Sep 1, 2014 09:04 AM

single post pages use the 'single.php' template

JimTrail Sep 1, 2014 09:37 AM

Juggledad;

Thanks for the help.

I updated to the latest version of the Montezuma theme the other day. I had forgotten but I had made a list of changes that I made to the previous version.

What I have got is a text file where I am making a list of the changes so when I update I can remind myself.

That is probably the best way to do what I need rather than try to figure out how to write a plugin.

Thanks again.

juggledad Sep 1, 2014 10:30 AM

doing an update shouldn't change any theme option changes you made. If you go in and change the theme code - yes it will wipe them out, but changing a virtual template (like the single.php virtual template) will not be effected by a theme upgrade.


All times are GMT -6. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.