Wordpress variable - wordpress

I just think about that, easy to do in non cms site, but in wordpress site... i like to know YOUR approach to that problem
I have a BIG site (200 pages)... and at a lot of place, the info#something.com, the 000-000-0000 telephone and send your check to 123 easy street, Canada...
all that email, telephone, and address... should reside in one place (a post or a var) and when you need to insert it you should used the short code [tel] or [email].... but how...
is there a plusgin that can define var, or a tutorial to do that... do you only have to change it ONE for the whole site..
Any idea is welcome.... now, find and remplace is my friend !...
thanks in advance

You could try the Custom Config plugin:
http://wordpress.org/extend/plugins/custom-configs/
It will allow you to create custom global variables that are contained within the CMS (otherwise you'd be declaring these variables within the template config).
Usage to output a variable onto the page would be something like:
<?=get_config('myVariable','default')?>

Related

Nested Shortcodes?

For my WordPress site, I am using both PODS, and WPDataTables to manage my data. With that, I am using WPDT's "placeholder" feature to create dynamic SQL queries that will display different data depending on what user is logged in. Currently, I can ALMOST do everything I need, but not quite. This is more or less what I would like to achieve (var1 = the output of another shortcode):
[wpdatatable id=14 var1=
[pods name="User" template="Company" where="id = {#user.id}"][/pod]]
[/wpdatatable]
This shortcode is working, and will pull back a single number, based on the user that is logged in:
Company: [pods name="User" template="Company" where="id = {#user.id}"]
And this code is working if I hardcode a specific value to var1:
[wpdatatable id=14 var1=5]
Basically, I have two separate shortcodes that work individually, but will not work when put together. I was wondering if something like this would be possible? Or if I needed to maybe think of a new approach. Thanks in advance!
Side Note: I have tried using the "Outerbridge Nested Shortcodes" plug-in without any luck. After talking with the plug-in author, I discovered that this plugin only works for:
[tag-a] [tag-b] [/tag-a]
And not:
[tag-a [tag-b] ]
That's something wpdatatable needs to enable like we do it for pods but that would be around the other way see how it's done for pods: https://pods.io/docs/build/using-shortcodes-pods-templates/

Smart IP module - how to check what every country sees

Unfortunately i don't have too much experience with drupal so please feel free to ask for more information if needed and i will provide.
I am using Drupal 7.34 and i have a module installed called Smart IP. I have different blocks which are shown depending on the users IP/Location/Language.
For example, when editing a block, going to the Show block on specific pages -> Pages on which this PHP Code returns TRUE (experts only) with the below code :
<?php
$smart_ip_session = smart_ip_session_get('smart_ip');
if (isset($smart_ip_session['location']['country_code'])){
if ($smart_ip_session['location']['country_code'] =='GR' && drupal_is_front_page()){
return TRUE;
}
}
?>
The above block will be shown if it's a drupal_is_front_page()) and if country_code is GR.
Since i am from Greece, the specific block is going to be loaded. How can i check how the block of another country looks like?
A couple of options:
If you know already how you want this function to behave then use dependence injection to return a mocked version of this object.
This will allow you test the rest of the application using whatever country's settings you like.
Or, if it is this function itself you need to test then use a VPN to request the page from another country.
e.g. https://www.operavpn.com/ or https://chrome.google.com/webstore/detail/unlimited-free-vpn-hola/gkojfkhlekighikafcpjkiklfbnlmeio
Both free to use.

How many controller files should I create in my Symfony2 application?

In the src/AppBundle/Controller folder, there is a file called DefaultController.php.
I'll create url's like below, should I use just DefaultController.php for all URL requests or is it recommended to use a different controller.php file (UserController.php, FeedController.php, etc) for each part of the site? (profile, feed, settings, etc)
I also have another question. As far as I understand, we put our html files in our /App/Resources/views folder to keep them separated. Do I need to create a specific file for each part of the website just like flat PHP? (settings/index.php, settings/password.php, settings/things.php, settings/security.php, etc).
I am not sure whether this question is suitable for SO or not.
settings
/settings
/settings/password
/settings/things
/settings/security
/settings/privacy
/settings/ban
/settings/notifications
/settings/mail
/settings/mobile
/settings/applications
/settings/advertising
/settings/invite
user
/username
/username/photos
/username/friends
/username/posts
feed
/feed
/feed/posts/postid
For both questions is no hard answer. I should create a controller for each part of your website AT LEAST. Theoretical you could throw everything into one controller but it will be a very long list if you are finished. Another problem is that your action names like indexAction will repeat which is of course not possible because every method must have a different name. And names like index1Action, index2Action and so on is also not a proper solution :-). Another helper is to create an own controller for every ENTITY.
Twig files should only be written for one page only or only for a part of a page. Imagine that you have a homepage with last 10 newsitems but also a news page with more news items (maybe with pagination). The newsitems themselves looks the same on both pages. In this case you could make a home.html.twig, a news.html.twig and also a newsitem.html.twig. Both home and news will include newsitem to show the newsitems...
Hope i gave you a light.

wp_list_comments give first and last name

I am using this standard function to displayy comments on a website running Wordpress 4.0:
wp_list_comments();
However, that way comments by registered users are shown with their username instead of their first and last name. This is obviously also a security risk.
Anyway to influence this function to give our first and last names or do I have to do a workaround?
Thanks!
Wordpress will always list the preferred Display Name your users can set in their profile settings. Just have them set it to their preferred name there and you are good to go.

Open direct links to AX-objects or datasets from external application

Is there a way to open a specified document, eg "production order 123" or form, eg "purchase orders" in Ax2012 from an external application directly?
In detail, I'm looking for something similiar like AXPath, but this doesn't work with versions greater then 2009.
Is there any ( maybe included ) way to achieve this?
There is! It's using AX's drilldown functionality which uses AxHLink.exe to handle dynamics:// URLs, which are passed to the Classes\SysStartupCmd function. You could also create some custom code there if you wanted to launch the AX client executable directly.
My question I asked some while back should have a great deal of useful information in it here:
What handles dynamics:// URLs?
Some more can be found: http://technet.microsoft.com/en-us/library/aa834337.aspx
EDIT:
It sounds like you are confused or the posts weren't clear enough. I think you have 3 basic options.
Dynamics:// URLs are handled by AxHLink.exe and they only seem to handle drilldown, viewalert, and viewalertrule. So if you want to use Dynamics:// URLs, you will need to hi-jack those somehow. There is a pastbin from Jan in that other stack post.
Create a custom URI handler and event poller (lot of work) see http://axcoder.blogspot.dk/2010/10/how-to-open-form-in-running-ax-from.html
Extend SysStartupCmd and then instead of using Dynamics:// URLs, just call Ax32.exe -startupCmd directly and a parameter can be passed to your custom class.

Resources