Sanjeev Sabhlok's notes on technology, hardware, gardening

Category: Wordpress

How to change URLs linking public documents, to Onedrive, on WordPress. Redirect through .htaccess.

I've been publishing a lot of "work in progress" documents on sanjeev.sabhlokcity.com/Misc over the past few years. To make these easy to edit and to use the "auto-upload" feature provided by Onedrive, I've got to not only update the URL of these files across the entire WordPress system, but also ensure that anyone who stumbles to the old link is also able to reach the new link.

Step 1: Upload the file into the "Public" folder of Onedrive (this has default public settings).

Step 2: Find the URL of the Onedrive file by right click on the file > share > create link (choose public) > in the URL replace "redir" by "download".

Step 3. Create a bit.ly URL since the Onedrive URL is extremely long.

Step 4. Replace the link on the relevant Wordpres widget with the bitly link, e.g. http://1drv.ms/1jMLtCi

Step 5: Go to the phpmyadmin, selecte the relevatn database and use the following as example to replace all outdated references (run the SQL) with the new link

UPDATE wp_posts SET post_content = REPLACE (  

post_content,  

'http://sanjeev.sabhlokcity.com/Misc/The-truth-about-Modi.doc',  

'http://1drv.ms/1jMLtCi');  

Step 6: In the root directory, add the following line into the .htaccess file (just above the "turn off the server signature on bulletproof htaccess, or close to the top on any non-bulletproof htaccess, I presume)

redirect http://sanjeev.sabhlokcity.com/Misc/The-truth-about-Modi.doc http://1drv.ms/1jMLtCi

MY HTACCESS CHANGES FOR THE RECORD

redirect http://sanjeev.sabhlokcity.com/Misc/The-truth-about-Modi.doc http://1drv.ms/1jMLtCi
redirect http://sanjeev.sabhlokcity.com/Misc/Notes-on-innovation.doc http://1drv.ms/1nBRZPx
redirect http://sanjeev.sabhlokcity.com/Misc/Modi-s-lies-to-the-SIT.doc http://1drv.ms/SrOWMI
redirect http://sanjeev.sabhlokcity.com/Misc/Free-Speech-Manifesto.doc http://1drv.ms/1gq9ujx
redirect http://sanjeev.sabhlokcity.com/book3/hc.doc http://1drv.ms/1hikHxJ
redirect http://sanjeev.sabhlokcity.com/Misc/Scientific-Hinduism-meat-beef-India.doc http://1drv.ms/1lJoiG5
redirect http://sanjeev.sabhlokcity.com/Misc/Scientiific-hinduism-2-institutionalised-oppression.doc http://bit.ly/1jMJpMf
redirect http://sanjeev.sabhlokcity.com/Misc/The-Robotic-Age.doc http://1drv.ms/1hiCUes
redirect http://sanjeev.sabhlokcity.com/Misc/Notes-on-IQ.doc http://1drv.ms/1p2s5Vl
redirect http://sanjeev.sabhlokcity.com/Misc/Arvind-Kejriwal-is-a-socialist.doc http://1drv.ms/1vV3BiH
redirect http://sanjeev.sabhlokcity.com/Misc/The-net-benefit-of-CO2.doc http://1drv.ms/RleSIG
redirect http://sanjeev.sabhlokcity.com/Misc/Cost-benefit-analysis.doc http://1drv.ms/1pllKSh

Continue Reading

css changes to Modern Business by Slocum Studio (style.css)

Very gaudy font sizes for blocquotes.

I’ve changed blockquote section in style.css to:

article.content blockquote, article.full-content blockquote {

    background: #f9f9f9;
border-left: 10px solid #ccc;
padding-left: 55px;
padding-top: 5px;
padding-bottom: 30px;
font-size: 18px;
line-height: 1.7em;

}

Also some changes to the header fonts which I’ve undone while downloading the update to the theme.

 

Continue Reading

How to set up and use Quantcast

Quantcast seems to be helpful in terms of the data it provides to users but it has one of the most badly designed interfaces. No one can find out anything about how to use it. And its key buttons are all over the place. I’m building this for my own use.

First of all, the site is a total mess. You can’t find anything.

First – before doing anything else, click the following domain

https://www.quantcast.com/measure/home

2015-10-20 10_07_40-Greenshot

Now that you are the right spot, you can do the following:

Insert quantcast code into WordPress blog

Step 1: Get the Quantcast code 

1. click “Add a website” which is to the right of the screen, above.

2. Enter the name of the URL

[Under Quantify Your Site (right side of page), click Generate Tag. [see this]]

Step 2: Add the code to footer.php

In the HTML code of every webpage of your site, place the relevant code just before the </body> tag and any other measurement tags.

OPTION 1: through WordPress dashboard

Appearance> Editor> footer.php

Add quantcast tag before </body> tag.

OPTION 2: “Add to footer” plugin

[NOTE TO MYSELF: THE CODE IS ALREADY IN THE PLUGIN. ALSO I’VE STORED IT IN AN EMAIL]

There is a bit of description on Quantcast website about how this is done: here.

[copy for my record:

To get Quantified:

  1. If you have not already done so, create a Quantcast account.
  2. Sign in. Under Quantify Your Site (right side of page), click Generate Tag.
  3. Under Your Site, enter the URL (web site address) you’re looking to Quantify.
  4. Under Your Tag, select and copy the code shown. This is the tag you need to place on your pages (example below).
  5. In the HTML of all website pages, place the following code just before the</body> tag and any other measurement tags.
  6. Optional – Under AdChoices Privacy Icon, if you want to display the AdChoices icon on your site, check the option. This free offering enables you to participate in ad industry self-regulation by providing consumers with choices and control.Learn more.
  7. Optional – Under Advanced Settings, check Use multiple p-codes in your tag if you want to create a tag which is tied to multiple accounts. Learn more.
  8. Click Submit Site.

After you have implemented your tag, Quantcast will send you an email verifying that everything is working properly. You’ll receive another notification when reports are ready to view.

If you’re looking to split the asynchronous tag or use multiple IDs in a tag, consult the advanced measurement guide.

How to insert subdomains/ properties/ sites into Quantcast

Now for the next step.

Click properties tab (on the top) – and check if yoursubdomain has been included. If not, do the same steps as above and ensure that the subdomain is specifically quantified.

Continue Reading