WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Aggregating within posts and suppressing class display (19 posts)

  1. the daily slog
    Member
    Posted 4 years ago #

    Sorry, newbie here.

    1. I have 4 fixed categories to which I add text over the course of a week and then close them as a single post (under a date heading). I seek to have the text visible as it accumulates. Help, please.

    2. I am using the Twenty-Ten theme and seek to suppress the author and date detail. Deleting the single.php entry-meta div class didn't help. Suggestions?

    TIA

  2. vtxyzzy
    Member
    Posted 4 years ago #

    I am not sure I understand exactly what you are doing for question 1. Are you saving the daily text as a draft? Can you publish the post on the first day, and then update it during the week?

    For question 2, edit style.css at line 578, and change this:

    .entry-meta {
    color:#888888;
    font-size:12px;
    }

    to this:

    .entry-meta {
    display: none;
    color:#888888;
    font-size:12px;
    }
  3. the daily slog
    Member
    Posted 4 years ago #

    Thanks on question 2.

    WRT Q1, Non-registered community members submit entries for a weekly (push) posting and I need the interim compilation to be visible until the edition is closed, once per week. TIA.

  4. vtxyzzy
    Member
    Posted 4 years ago #

    Where do you keep the 'interim compilation'?

  5. the daily slog
    Member
    Posted 4 years ago #

    I seek to have the text visible during the weekly compilation process. We are a community with announcements of 4 categories: Congrats/Bereavement, Hospitality, Calendar and Personal/Basement. Members submit their announcements in a random process. I seek to give a weekly time stamp and volume wrapping to the total. TIA.

  6. vtxyzzy
    Member
    Posted 4 years ago #

    I know you want to have it visible.

    I think I understand what you want to do in the future. I am trying to understand how you are doing it now before I try to suggest a different way. Does a member submit a post? Do you enter it daily into a post? Is the weekly summary a post?

  7. the daily slog
    Member
    Posted 4 years ago #

    At present, community members randomly email me notifications they want posted. I create and update an html page which closes weekly and then the process is renewed. TIA.

  8. vtxyzzy
    Member
    Posted 4 years ago #

    Can you go ahead and post the first notification you get, then update the post as you receive more? What am I missing?

  9. the daily slog
    Member
    Posted 4 years ago #

    Yes, but I seek:

    • To effortlessly preserve the categories ordinal position
    • To automatically aggregate all categories into a single posting
  10. vtxyzzy
    Member
    Posted 4 years ago #

    OK, a little progress in understanding the process. Here is what I think you are doing:

    • To start a new week, you create 4 different HTML documents with the first email from each category.
    • As you receive more emails, you add to the appropriate document of the 4.
    • At the end of the week, you paste each of the 4 category documents into a post for the week.

    If that is not correct, please explain further.

    To provide an automated solution, I will need to have a link to your site, possibly access to your theme's code, and some specifics about the location and names of the 4 documents for a week. If you are using a freely available theme, I can download it and install on my test site. If the theme is a premium (purchased) theme, I may not be able to help.

  11. vtxyzzy
    Member
    Posted 4 years ago #

    After thinking about this a little more, I think I have a solution although it may require some changes based on your needs. My idea is to use a shortcode in the weekly post to read in the four category files.

    Here is how to implement it:

    • Create a folder named 'notifications' off your site home folder.
    • Each week create a subfolder of notifications named for the starting day of the week, in the format 'yyyymmdd'.
    • From looking at the link you provided, I have assigned names of 'announcements.html', 'hospitality.html', 'calendar.html', and 'personal.html' for the 4 files to go in each week's folder. Create these as empty files to start the week.
    • Add the code below to your functions.php file to create the shortcode filter.
    • Create a post to start the week, and place the shortcode '[mm-notifications week=yyyymmdd]' where you want the 4 files inserted. The files will be inserted in the order that you define the names in the code.

    If this is totally off-track, please let me know.

    The code:

    <?php // Format: [mm-notifications week=yyyymmdd]
    // Include four HTML files from subdirectory ABSPATH/notifications/$week/
    function mm_notifications_func($atts) {
    	extract(shortcode_atts(array(
             'week' => '',
                                    ), $atts));
       $file1 = 'announcements.html';
       $file2 = 'hospitality.html';
       $file3 = 'calendar.html';
       $file4 = 'personal.html';
       $files = array($file1,$file2,$file3,$file4);
       $warn = '<span style="color: red; font-weight: bold;">WARNING:</span>';
    	$output = '';
       if (!preg_match('/\d{8}/',$week)) {
          $output = "$warn The week parameter is incorrect or  missing. Please use YYYYMMDD format.";
       } else {
         foreach ($files as $file) {
           $filepath = ABSPATH . "notifications/$week/$file";
           $fh = fopen($filepath,'r') or $error=true;
           if ($error) {
             $output .= "<p>$warn $filepath cannot be opened.</p>";
           } else {
             $output .= fread($fh,filesize($filepath));
             fclose($fh);
           }
         }
       }
       return $output;
    }
    add_shortcode('mm-notifications', 'mm_notifications_func');
    ?>
  12. the daily slog
    Member
    Posted 4 years ago #

    Wheeew! Thanks for the effort. I will give it a try on Sunday (after our sabbath)...

  13. the daily slog
    Member
    Posted 4 years ago #

    Alas, not quite......

    When text "mm-notifications week=20100702" (with and without []) is entered and attempted to save draft:

    "Warning: Cannot modify header information - headers already sent by (output started at /home5/bermansh/public_html/bulletin/wp-content/themes/twentyten/functions.php:2) in /home5/bermansh/public_html/bulletin/wp-includes/pluggable.php on line 890".

    See attached screen capture.

    I am using the standard Twenty Ten 1.0 by the WordPress team
    The 2010 default theme for WordPress.

    All of this theme’s files are located in /themes/twentyten.

    TIA.

  14. the daily slog
    Member
    Posted 4 years ago #

    Alas, and now I can't access anything as I get:

    Parse error: syntax error, unexpected '<' in /home5/bermansh/public_html/bulletin/wp-content/themes/twentyten/functions.php on line 543

    despite having replaced the entire functions.php which ends on line 542

  15. vtxyzzy
    Member
    Posted 4 years ago #

    I am terribly sorry for the trouble. It turns out that the TwentyTen theme's functions.php is TOTALLY different from others.

    I think you would OK after deleting all the code I supplied. If not, replace functions.php with a fresh copy from a new download of WP 3.0. If you don't want to do that, I can email you a copy if you email me at mmcdonaldky =at= gmail.com.

    Once you are working again, it would be wise to create a child theme of TwentyTen to hold your changes. That is really easy to do:

    • Create a new folder in the themes folder - call it twentyten-child.
    • Copy the file below into twentyten-child/style.css.
    • Go to Admin->Appearance->Themes, and activate the child theme.
    • Done!

    Now, any changes you make can be to the child, leaving the parent untouched.

    Put the code I showed earlier into a new functions.php in the child folder and give it a try.

    Again, very sorry for the trouble.

    style.css:

    /*
    Theme Name: Twenty Ten Child
    Description: Child theme for the Twenty Ten theme
    Author: Your name here
    Template: twentyten
    */
    
    @import url("../twentyten/style.css");
  16. the daily slog
    Member
    Posted 4 years ago #

    Aargh! same error

    Parse error: syntax error, unexpected '<' in /home5/bermansh/public_html/bulletin/wp-content/themes/twentyten-child/functions.php on line 542

    It doesn't like your code.

  17. vtxyzzy
    Member
    Posted 4 years ago #

    It looks like you put the original functions.php along with my code - that will not work. Put JUST MY CODE in the new functions.php, leave the original in the twentyten folder alone.

    That should fix it.

    Sorry for your frustration, but don't worry, we will get it right. I have tested the code with the original default theme and it works perfectly. The only problem is the new structure of twentyten's functions.php. Once you get the code into its own functions.php in the child folder, it should work.

  18. the daily slog
    Member
    Posted 4 years ago #

    Thanks; up and running. And yes, your reasonably elegant solution addresses my posting request. Ticket closed.

    The related issue is I seek to have only the announcements.html sent to social media as it is being compiled, but I think this is beyond our purview...

    Thanks again. -PL

  19. vtxyzzy
    Member
    Posted 4 years ago #

    You are welcome - but tell me more about sending announcements.html to social media. What do you need, and what do you do now?

Topic Closed

This topic has been closed to new replies.

About this Topic