How to add Post’s last modified date to the Twenty Seventeen theme.
Step 1.) Add custom style for text color /wp-content/themes/twentyseventeen/style.css
/* Change to fit your needs */.entry-date.published{color:#e1e1e1;}.modified-date{color:#9ecbff;margin-left:8px;font-style:italic;}/* Add a subtle separator */.date-separator{margin:05px;color:#666;}
Step 2.) Modify function twentyseventeen_time_link() /wp-content/themes/twentyseventeen/inc/template-tags.php
if(!function_exists('twentyseventeen_time_link')):functiontwentyseventeen_time_link(){$modified_time=get_the_modified_time('U');$posted_time=get_the_time('U');if($modified_time>$posted_time){// Format for published + modified date with better spacing and structure$time_string=sprintf('<time class="entry-date published">%1$s</time><span class="modified-date">Updated: %2$s</span>', get_the_date(), get_the_modified_date());}else{// Format for published date only$time_string=sprintf('<time class="entry-date published">%1$s</time>', get_the_date());}// Wrap the time string in a link, and preface it with 'Posted on'.returnsprintf('<span class="screen-reader-text">%1$s</span><a href="%2$s" rel="bookmark">%3$s</a>', _x('Posted on','post date','twentyseventeen'), esc_url(get_permalink()),$time_string);}endif;
This is a script to run mongodump in a running MongoDB container, and backup to the local server as a tgz file. 1.) Runs mongodump 2.) Creates a tgz file where the script is ran 3.) Removes any old tgz files that are in the same directory
// My MongoDB is container is running in Docker Swarm mode to use Docker Secrets.
#!/bin/bashset-euopipefail# CreateatempdirectoryforthebackupTMPDIR="$(mktemp -d)"trap"rm -rf $TMPDIR"EXIT# GettherunningMongoDBcontainerIDCONTAINER_ID=$(dockerps--filter"name=btc_mongodb"--format"{{.ID}}"|head-n1)if [ -z"$CONTAINER_ID" ];thenecho"No running container found with 'btc_mongodb' in its name."exit1fi# RetrieveMongoDBcredentialsfromsecretsinthecontainerUSERNAME=$(dockerexec"$CONTAINER_ID"cat/run/secrets/mongo_root_username)PASSWORD=$(dockerexec"$CONTAINER_ID"cat/run/secrets/mongo_root_password)# Runmongodumpinsidethecontainer,outputtingto/tmpdockerexec"$CONTAINER_ID"mongodump \--uri="mongodb://$USERNAME:$PASSWORD@localhost:27017/" \--out/tmp/mongodump# Copythemongodumpfromthecontainertothehost's temp directorydockercp"$CONTAINER_ID":/tmp/mongodump"$TMPDIR"# CreatethearchiveinthecurrentdirectoryBACKUP_FILENAME="$(date +%Y-%m%d-%H%M)-btcMongo.tgz"tar-czf"$BACKUP_FILENAME"-C"$TMPDIR/mongodump".# Removeanyprevious*-btcMongo.tgzexceptthenewlycreatedoneforfin*-btcMongo.tgz;doif [[ "$f"!="$BACKUP_FILENAME" ]];thenrm-f--"$f"fidoneecho"Backup complete: $BACKUP_FILENAME"