Getting Site permalink url of Associated template page by template_page_name

WordPress have the query function which filters associated template pages. If we require the page URL automatic by using template name we can use like this function to get the associate page link.

* Get the template related page url by template name
* input template name like $TEMPLATE_NAME = template-service.php
* @ returns {siteurl}/service
* Service is page slug which is created in page

function getTplPageURL($TEMPLATE_NAME){

$pages = query_posts(array(
‘post_type’ =>’page’,
‘meta_key’ =>’_wp_page_template’,
‘meta_value’=> $TEMPLATE_NAME

$url = null;
if(isset($pages[0])) {
$url = get_page_link($pages[0]->ID);
return $url;
echo getTplPageURL(template-service.php);
* Returns the associate page_url
* which is created in pages with using this template


Creating Custom Media Upload with user value

Customizing WordPress Media :{


function provide the option for stetting up the custom value on Upload light box screen.

I have customized the Upload preference up wordpress light box for uploading audio file with it suitable lable and command.

$(document).on(‘click’, ‘.pcs_audio_upload’, function() {
current = $(this);
var post_id = current.attr(‘data-post-id’);
if( null != current) {
var pkb_uploader ={
title: ‘Service News – Select Audio file only’,
button: {
text: ‘Set Audio’
multiple: false,
}).on(‘select’, function() {

var attachment = pkb_uploader.state().get(‘selection’).first().toJSON();
var FileName = attachment.url;
var link = FileName.split(‘wp-content’);
var file_path = ‘/wp-content’+link[1];
return false;

And Next On update option of Upload button :

//Prepare frame
var frame ={
title : ‘Pick the images for this work’,
multiple : true,
library : { type : ‘image’},
button : { text : ‘Insert’ },
frame.on(‘close’,function() {
// get selections and save to hidden input plus other AJAX stuff etc.
var selection = frame.state().get(‘selection’);
frame.on(‘open’,function() {
var selection = frame.state().get(‘selection’);

//Get ids array from
ids = jQuery(‘#<?php echo $this->id; ?>’).val().split(‘,’);
ids.forEach(function(id) {
attachment =;
selection.add( attachment ? [ attachment ] : [] );




Setting up Symfony Project on windows

Hi guise i Have share my experience to you when What i have got when setting up symfony project on my computer.

I have share the steps require to install symfony project.

I have created the project folder name pkb and url : pkb.localhost

Step 1: At first we need to create development environment
[Which is located in C:\WINDOWS/system32/drivers/etc/hosts ] Open this file and add the virtual host mapping with localhost ip.
#hosts file pkb.localhost
# add the localhost ip( with virtual domain (pkb.localhost). [pkb.localhost] is virtual host now

Step 2:
Need to add the virtual host mapping with project name.
Which is located into Wamp server [Apache/ httpd.conf].
Local location where the wamp version 2.2 have installed into D:
So the absolute location : D:\wamp\bin\apache\apache2.2.22\conf\httpd.conf
Edit File (and add the virtual host mapping with project)
# httpd.conf

ServerName pkb.localhost
DocumentRoot “D:\development\sfprojects\pkb\web”
DirectoryIndex index.php
<Directory “D:\development\sfprojects\pkb\web”>
AllowOverride All
Allow from All

Alias /sf D:\development\sfprojects\pkb\lib\vendor\symfony\data\web\sf
<Directory “D:\development\sfprojects\pkb\lib\vendor\symfony\data\web\sf”>
AllowOverride All
Allow from All
Step 3:
Create project folder with {Drive or D:/}development/sfproject/{project_name}/lib/vendor
Now in this example:
(Create below folder structure)

After creating folder structure for symphony project installation we need the symphony version and place this symphony version folder content with making sure of folder name symphony.
For download latest stable version of Symfony. Go through this link
Now we find the symphony project [we have multiple files and folders in symphony downloaded folder.] D:\development\sfprojects\pkb\lib\vendor\symfony\

[Put the downloaded symfony project under vendor folder]


Step 4:
After putting symphony project into lib/version
We need to help from command line for generating default project files and folder.
Go to project installed folder by command line.
Run >> cmd
Go to place of project root folder {pkb} for this example.
\data\bin\symfony generate:project test –orm=Propel


[It generates the project default file and folder structure.] Step 5:
For generate the application the application have modules,configuration,libraryfiles and template files.
Below syntax creates the frontend application with its folder structure.
D:\Development\sfprojects\pkb>php symfony generate:app frontend


Step 6:(Database Connection)
Create database from the php myadmin connect it from the application.
[below is the connection of database pkb_symfony with mysql user name root with blank password(If we have password of mysql we need to put it after root with space like root password )] D:\Development\sfprojects\pkb>php symfony configure:database “mysql:host=localhost;
dbname=pkb_symfony” root
(It creates the connection file of database pkb_symfony with symphony project it is located in
D:\development\sfprojects\pkb\config\databases.yml File)

Step 7: (Generating schema,model and forms)
Symfony generates all the schema file [The yml file which have all table structure and data types of this database with yml structure.], model [The connection between the controller(action) database query supportive function will automatically generated. ] and forms (all the default forms which helps to generate form of the table.) file.
We need to run the command to generate these all
Schema Files
Model Files
And Forms file
Command >

1. D:\development\sfprojects\pkb>php symfony propel:build-schema

2. D:\Development\sfprojects\pkb>php symfony propel:build-model
3. D:\Development\sfprojects\pkb>php symfony propel:build-froms


Download Word File