How could I manually translate a template I've downloaded? - php

This is my second day with wordpress and I would like to translate the whole website to my native language (Portuguese). I've translated a couple buttons and stuff, but it takes me a while to find where it is within the PHP codes, and, a friend of mine who works with wordpress, said it could be dangerous to alter the theme and cherry framework files.
I am looking for a tool/plugin where I can manually translate all the strings, and not use Google translate, as most plugins I've saw. Any tips?

Alright, so I managed to solve my problem with a WordPress plugin called Say What. After installing it, it's pretty simple to use! For instance, I have this string on my template:
<?php _e('Search for: ','cherry');?>"<?php the_search_query(); ?>"
Then, on Say What plugin, all I gotta do is:
Original String = Search for:
Text Domain = cherry
Replacement string = Buscar por:
It's working great! Thanks!

Related

Replace word in Wordpress back office

I am using a theme that has a lot of tools I need for a project, the only issue is they have a really long company name and it is everywhere! The double lines are driving me mad.
I know how to replace a string on the frontend using the below code, but I dont know how to modify it for the admin area.
function replace_content($content)
{
$content = str_replace('##Replace Me##', '##With Something Else##',$content);
return $content;
}
add_filter('the_content','replace_content');
As far as I know the admin section doesn't have anything similar to the_content to filter off of, since any plugin/theme/extension could be writing to the backend in any way they want. You could probably find a good number of hooks to filter it out in most places (maybe the theme itself provides such hooks?) like you do with the content, but probably couldn't get all of them.
Given the way theme authors like to write their c̶r̶a̶p̶ code. I'm guessing this is hard coded into the theme, in which case the most viable option is unfortunately to edit the theme. If you can ssh into the server, command line tools like sed should make this basically a one-liner like the answer to this question.
If they happened to be nice enough to put their name in the database, you can use a plugin like Search & Replace to change all instances of it in the db.

conflicting functions when using two includes (mybb and wordpress)

I use MyBB for forum and Wordpress for blog. When I try to integrate both together into a page, I get conflicts between functions. The forum header and the wordpress includes have some functions with the same identifier.
I need both functions but I obviously can't change the name of something inside wordpress or mybb.
What are the solutions to these conflicting problems?
Can I deinclude an included file?
If I could use iframe then it wouldn't look good with the scrolls and the border. If this is the only way then how can I remove the border and the scrollbars so that it would look exactly the same when the code was in the original page itself?
First of all: That is a hell of a task.
Still thou, if you aim to do it, read up on namespaces.
I figure it is possible to add those to all wordpress classes and all myBB classes.
You would have to do a lot of rewriting, but some search and replace tools using regular expressions should be able to help you with that.
You could also try to havew them seperately (yourdomain.com/myBB and yourdomain.com/wp) and integrate them via webservices. So you myBB would access wordpress data via RSS?

Joomla - Multiple Layouts in one template file

I am starting to build a website in Joomla 1.6. The website is going to primarily have two layouts. One for the homepage and the other is for all the other sub-pages.
The catch: I am wanting to put both the layouts in one template (or folder).
I have seen this done before by using a conditional statement with the JURI:current() function, but for some odd reason, it is not working properly for me.
Here is some basic psuedocode to indicate what I am trying to do...
<?php
$HomePagePath = 'Homepage URL here...';
echo JURI::current(); // Just to test what the current output is going to be.
?>
<?php if(JURI::current() == $HomePagePath ): ?>
Template for homepage here
<? else; ?>
Template for sub-pages here
<? endif; ?>
When I test what I am building with this code, it is not working properly. I have ensured several times that the output from the current JURI matches the current URL in the browser. It is showing me the sub-page content rather than the homepage content... I am not sure what is causing this :/ ...
I am currently running this website without a real domain behind it. I am using the GoDaddy Preview DNS feature for the time being... This feature basically gives me a temporary domain until I point the appropriate one. I do not know if this could have something to do with the current JURI not parsing properly? This is the only thing I can think of that would be causing this...
I guess my next question is... do you know another method, other than the current() function, that will accomplish what I am trying to do?
Thanks!
Chris
You can use template Styles to help in this process.
You can duplicate styles, and change things about the style - but each style will use the same 'template'.
I've played around with it a bit and I think it's probably pretty close to exactly what you're looking to do - unless you wanted a completely separate look for the 2nd template in which case using 2 templates will probably be the 'best bet'.
I'd recommend looking into template styles though - essentially you could have as many 'styles' of the template as you want, but everything is based off of that one 'template', it's only the style that's changing. You can go into your menu items and select that style from the dropdown for templates. I hope that helps to make sense, because it sounds like exactly what you're looking for.
Also, I'd recommend following the upgrade to 1.7 before you get too far along in development. Both for security reasons, and to make sure your template items work smoothly with 1.7 (they're pretty similar, but I've had some templates that didn't enjoy the jump from 1.6 -> 1.7).
*edit: here is a little information on it: Joomla Styles

PHP wordpress style related posts

Do you know how wordpress decides which related posts to show?I mean I know if it has tags, then it's easy but if it doesn't?
Best Regards,
Generally the 'related post' function of a Wordpress Blog is created by the owner of the blog, or using a plugin. I can imagine that those plugins either look for new posts with similar tags or in the same category as the post it is displaying.
As far as my knowledge extends, I do not believe that Wordpress has a show_related_posts function, although I may be wrong. If it does, it would be simple enough to look it up on the documentation at wordpress.org.
Also, another good part about OpenSource programming is that you can simply go in and look at any of the code that you are curious about. I personally use Notepad++, and when I find a function in Wordpress or any other CMS I am not famillar with, I simply copy and paste the function name, and do a Multi-File search on the function to figure out where it is declared.
I'm going to have to go with Chacha102, as far as I know this can only be done using plugins or by hacking the code yourself.
I did something similar by falling back on the post's category if it had no tags, works pretty well too.
This guy has the leading plugin for related posts. I'd download that and take a peek at his code and see how he does it. Then you can reverse engineer it and make it your own. The beauty of opensource.
http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/

Setup multi languages wordpress

I need to setup a blog using wordpress engine but i need it support multi languages (3 languages), currently i am thinking of using custom field to identify the language of current post though i knew thats not a best practices, does anyone has better suggestions?
I've tested 2 plugins that both looked very promising: qTranslate and Gengo
qTranslate works by adding inputs for all used languages for each post, Gengo used separate posts and links them in a "post Y is a translation of post X" way, which I preferred much (because it allowed me to not translate everything) and it worked fine for me.
I have used the xlanguage plugin and I am happy with it.
xlanguage site
I fi i remember well, wordpress uses a gettext "customization" library to translate itself.
I think you can make some options based on a session variable, about the translation files you're going to read.
Try using plugin wordpress WPML.

Categories