Categories
WordPress WordPress Development

Synchronising between Git and SVN

Synchronizing updates between the two repositories.

1. Clone the GitHub Repo

SSH

$ git clone git@github.com:Praison/seo-wordpress.git

HTTPS

$ git clone https://github.com/Praison/seo-wordpress.git

2. Change into the Directory

$ cd seo-wordpress

3. Set Up a Subversion tracking branch

$ git branch --no-track svnsync 
$ git checkout svnsync
$ git svn init -s https://plugins.svn.wordpress.org/seo-wordpress/ --prefix=origin/
$ git svn fetch --log-window-size 10000 #CAUTION THIS LINE TAKES A LONG TIME TO COMPLETE
$ git reset --hard origin/trunk

4. Merge changes from Subversion to GitHub

$ git checkout svnsync
$ git svn rebase 
$ git checkout master 
$ git merge svnsync 
$ git push origin master

5. Merge changes from GitHub and publish to SubVersion

$ git checkout master
$ git pull origin master 
$ git checkout svnsync 
$ git svn rebase 
$ git merge --no-ff master 
$ git commit 
$ git svn dcommit

### Tagging Releases
Tagging a release in Git is very simple:

$ git tag v1.0.4

To create an SVN tag, simply:

$ git svn tag 1.0.4

This will create `/tags/1.0.4` in the remote SVN repository and copy all the files from the remote `/trunk` into that tag, so be sure to push all the latest code to `/trunk` before creating an SVN tag.

### Subversion tagging

It appears that there is now an issue with git svn tagging. We now have to tag using subversion directly.
Download code from svn Repo

$ svn checkout https://plugins.svn.wordpress.org/stop-web-crawlers/

$ svn cp https://plugins.svn.wordpress.org/stop-web-crawlers/trunk https://plugins.svn.wordpress.org/stop-web-crawlers/tags/1.3.1 

Categories
WordPress WordPress Development

Bower JSON Dependencies Installation file

Bower.JSON

Bower.JSON file, which is used to Configure the Dependencies

Categories
WordPress

Creating Tables Boilerplate WordPress Plugin

Categories
WordPress WordPress Development

Get all category ids in WordPress [Array]

Choose either one of these options to Get all category ids in WordPress as an Array

Get all category ids, Option 1

$output_categories = array();
$categories=get_categories($args);
 foreach($categories as $category) { 
 $output_categories[] = $category->cat_ID;
}

Get all category ids, Option 2

$categories_ids = get_terms(
 array( 'category' ), // Taxonomies
 array( 'fields' => 'ids' ) // Fields
);

Categories
WordPress WordPress Development

Ajax Progress Bar

HTML

<style>
 #progress {
 width: 500px;
 border: 1px solid #aaa;
 height: 15px;
 }
 #progress .bar {
 background-color: #bbd;
 height: 15px;
 }
 </style>
 <div id="progress"></div>

AJAX

<script>

$.ajax({ 

url: ajaxurl.php
success:function(value){
$("#progress").html('<div class="bar" style="width:' + value.percent + '%"></div>');
}
}

</script>