How to change the slug in Ghost to include only year and month? - ghost-blog

In the latest release you have allowed us to add the date in the post slug. Is it possible to add only the year and the month? Even by editing the code? Because I'm trying to migrate from Wordpress I need it. In WP I use that format.
Note : I'm using Ghost 0.5

This is currently only possible to do in the database. You can change the value of the key permalinks in the settings table to read /:year/:month/:slug or run the following query on the database:
UPDATE settings SET value = '/:year/:month/:slug` WHERE key = 'permalinks'
In case you're using the default database (SQLite3) you can use a tool like SQLite Browser

Related

WordPress theme activation date

I was wondering if there is an activationdate stored somewhere. I searched for this in the database but cannot find it. I might make it through an option than but is there already something which I can use to determine on what date a theme ws activated?
Search your WordPress DB for theme_mods_ (in wp_options), there should be a timestamp (serialized) for each theme in there.

Serialized data in Wordpress form is "serialized" again when saved in mysql

I have a challenge with the way data is stored from Wordpress into mysql.
I'm new to Wordpress - but I'm trying to combine different plugins to achieve a specific functionality on a website.
Plugin #1 uses a specific type of post and some metadata - the plugin works great.
Plugin #2 can create posts of custom types and with custom metadata from the frontend. A flexible and great plugin.
My intention is to use plugin #2 to create posts from the frontend for plugin #1, which requires that some specific metadata contains specific values (otherwise the data are interpretted wrong). These values are saved with hidden inputfields in a form.
My challenge is that a value (which is serialized) is kind of serialized again. The value is a:1:{i:0;s:3:"198";}
Plugin #2 handles it well (as the data is shown correct in front- and backend of the plugin) - BUT in myPhpAdmin I can see that the data is saved differently s:20:"a:1:{i:0;s:3:"198";}"; - and hence that value cannot be understood by plugin #1.
I'm thinking of two options:
change something so s:xx: isn't added to the value(-s)
make the frontend form/plugin save the data in a serialized way so the value gets the correct format.
Any recommendations? - can I in anyway achieve my functionality?
Looks like
s:20:"a:1:{i:0;s:3:"198";}";
value is being serialized twice. You can check the plugin source code to see why the plugin serializing same value twice and if can prevent it than both plugin can share same data.

Importing excel files into Wordpress custom post

I'm starting work on a new Jobs website (where client can create new jobs through the WP backend). This is easy enough with setting up with a custom plugin like post-meta
Wordpress - post meta plugin
Which I've setup with custom post meta fields (location, sector, status etc.)
However when I create jobs and fill out the post meta fields and check the DB they all have array encoding:
E.g. a:1:{i:1;a:1:{i:1;a:1:{i:0;s:11:"Sydney City";}}}
How do I remove this so it simply says 'Sydney City' for the meta key value?
But even if I fix that, the client needs to send me a spreadsheet with all the jobs, how do I import something like that into the DB? For example how can a spreadsheet like this:
Job Name,Advertiser,Status,Start,Finish,Category,Suburb,State
Value 1,Hays Constr,Tender,12/3/13,12/4/14,....
Be imported into the meta_key, meta_value architecture? Is it even possible?
What do you think would be the way to proceed? I do want the client to be able to edit Jobs in the WP Admin... but I also need to import a ton of jobs and surely there's a quicker way to do this

Replacing meta-value on database

I need to migrate my wordpress site from local to online. I'm using custom post meta to upload files, so I need to change the string from "http://localhost/site" to "http://www.site.com/" but when I do it using some search and replace plugin, the value disapear. I think is because the new edit lock feature. How can I search and replace string on meta_value now ?
Try to use "WordPress Search and Replace Tool" - http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ This script allows to search/replace values even in serialized arrays.

Preparation & Data Preservation For WordPress .gz rRestoration

I have encountered a "problem" (fussy client) with a WordPress site and I will be restoring it back to a downloaded .gz database from two months ago. Now, in my work since then, I'd installed a new theme and created custom post types. The new theme has a number of custom CSS settings, and the custom post types have a number of files.
Since I'm doing a database restore to a snapshot before the new theme and custom post types existed, I have a few questions:
-Will this restore all setting to how it was configured at the time (general, reading, discussion)?
-Will the plugins that were added later just be deactivated?
-I'm guessing the new theme will still exist since its files are physically there. Will any settings on the new theme get erased with the database restore or will they stay and the theme just gets deactivated?
It's a messed-up situation and I basically want to restore back to August but archive my work on the new theme and custom posts if possible. Thanks!
If you restore the Wordpress database, you will change all of your settings back to the way they were at the time of the backup. The reason for this is the wp_options likely contains your theme options and definitely contains most Wordpress settings menu options (permalinks, reading, etc).
The plugins that were added later will be deactivated - there is a record in wp_options called active_plugins which is an array of your active plugin. Overwriting this value will disable new plugins, but as long as they are in the /wp-content/plugins directory, you can re-activate them, albeit with their settings missing. The same goes for your theme - as long as the files are there you can re-activate, but the missing options values will mean the settings are gone.
Now for something for helpful. First, definitely make a backup of your site as it exists now before you do anything else. Once you have a backup, rather than dropping the tables, etc, you can try renaming this schema so that it won't conflict, and then restore your backup to a new schema that contains the original name (the one Wordpress is configured to use now). With two schemas on the same server, you can now run queries to compare the current database values and the restored database values as well as insert them where necessary. Assume your restored schema is called restored and your current schema is called current, the following cross scheme query would show you any settings that don't exist in the restored schema:
SELECT co.option_id, co.option_name, co.option_value, co.autoload
FROM current.wp_options co
WHERE co.option_id NOT IN
(SELECT ro.option_id FROM restored.wp_options ro)
Add in some WHERE co.option_name LIKE 'key_% type queries to extract certain sets of values if you wanted to copy them into your restored schema. You might want to take a look at the wp_postmeta values in a similar way, or even compare values from the wp_options table where the ID/key exists, but the values don't match to see what changed.
Good luck!

Resources