Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

HosseinRafiei on "Change WP language in a PHP loop"

$
0
0

Hello,

I'm a WordPress developer. Recently I developed a multilingual plugin. In some sections of my plugin I need to change WordPress language and print some text.

Let's say these 3 languages are installed on my WordPress. I need to switch WP language in a foreach loop.

$langs = array('en_US', 'de_DE', 'es_ES');
foreach($langs as $lang)
{
    change_wp_locale($lang); /** I need a code to do this **/
    echo __('Hello', 'my-text-domain');
}

Any Idea? Your help is greatly appreciated.
Kind Regards,


LjasonH on "Query return codes"

$
0
0

Ello.

Google seems to have very little (or my search keywords are terrible) about the return codes on queries such as updating, deleting.

Would 0 or 1 be a successful return?

LjasonH on "Two sites one users database"

$
0
0

Yes yes, I know there is plenty of information out there already - but I'm just checking to see if anything has changed.

I did the usual match for both wp-config's:
define('CUSTOM_USER_TABLE', 'wp1_users');
define('CUSTOM_USER_META_TABLE', 'wp1_usermeta');

Just wondering if I have to match the define('AUTH_KEY'), secure key etc. to the original wp-config.php?

When logging in on the slave site I get the "You do not have permission" error.

Any tips or is a Multisite the way to go?

- Jay.

sescpapa on "random post metadata linking to specific page"

$
0
0

Ok.
Let' see if I can describe this.
I have the content of a random post that sort of welcomes you to the website I'm working on. And I have it followed by another parameter of that same post. It could be some metadata, though for now it's just the title.
What I want is to have that other parameter linking to a page where this random post will be permanently posted.
But the whole thing is a bit confusing because I haven't really understood how pages work. Are they subpages of my website that you can navigate to by clicking on buttons from my homepage? And can I really have them organized so that certain posts are posted on certain pages? And if so, can I get a post from a certain page and subsequently get some kind of metadata of that post linking to the page (not the post)?
Or is it so simple that I can just insert the desirable link in some metadata field when creating my post?

gucek on "Add featured image url from text editor"

$
0
0

Hi,
Anyone can help me? i want to add <featureimg> url </featureimg> function to my wordpress, its must be in text editor becouse i have plugin to import data from csv and url in sidebar is custom field, and its need profesional edition.
Please prompt response.
Dawid

ps. Sorry for my English.

anjx on "Rewriterule give me always 404 error"

$
0
0

Hi,
I want add the .html extension on just only page.
site.com/contact
to
site.com/contact.html

My .htaccess is:

# ==========================================================
# Rewrite old link
# ==========================================================
RewriteRule ^contact$ /subdirectory/contact\.html [R=301,L]
# ==========================================================
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdirectory/index.php [L]
</IfModule>

# END WordPress

The code: RewriteRule ^contact$ /subdirectory/contact\.html [R=301,L]
make me correct url site.com/subdirectory/contact.html but with 404 error.
Can you help me please?

MannyBlake on "New User Registration - KEEP getting new users register w/ out aweber confirm."

$
0
0

I have my new wordpress site all setup and redesigned with a free course as long as a user enters an email address.
The user receives the confirmation link and then gets to register for the course.
I KEEP on getting new user registrations via wordpress WITHOUT anyone confirming their email.
I have a CAPTCHA code for when a user registers as well, so I'm not sure what's happening.
Also my site doesn't have a "register" link as it is hidden.

I'm not sure I understand why this is happening, as neither do my developers. Does this happen to people with a wordpress site?

Manny

four321zero on "How do i fetch data from an external site?"

$
0
0

My site is http://trekkipedia.in

Am not at all familiar with PHP and have no knowledge of scripting either.

My question: Is it possible to create a widget or something on those lines to fetch data from an external site and display it in the sidebar of my website in a customized format.

The source site:
http://leh.nic.in/

If you look on the left hand side of this page; there is a section for "Road Status". I would like my site to fetch content from this site and update mine accordingly.

Similarly there are other sources with information on road status and weather conditions. Would like to incorporate that data into mine without having to manually update it every few days.

P.S.
I have tried
ELI's SHORTCURL Shortcodes to Fetch and Parse External Content
&
Fetch URL - Fetch and Parse External Content
But could not understand how to use them. Dont even know if they serve the purpose.


Kevin on "Using get_template_part with Ajax"

$
0
0

So I have read some pretty good blog posts and forum responses to help me along the way with this and it is just about finished. Since this is the first time I have worked with ajax and am not proficient in javascript, I am having trouble with some of the concepts and applying them correctly.

The goal in a nutshell: I would like to load a php file which executes shortcodes via an ajax request that executes when a user clicks on a button with the id #all-options. I am using 'include' instead of 'get_template_part' because my template file needs access to variables on the main page, but the solution should be the same for either method.

As far as I know, I am implementing ajax correctly via my functions. Here is the relevant code:

Enqueueing the ajax script

function phantom_scripts() {
	global $child_dir;

	/* Ajax Requests */
	wp_enqueue_script( 'ajax-stuff', $child_dir . '/js/ajax.js', array( 'jquery' ), true );
 }
 add_action( 'wp_enqueue_scripts', 'phantom_scripts' );

Ajax Handler

function portfolio_ajax() {
	include( 'templates/home-portfolio-layout.php' );
	die();
}
add_action('wp_ajax_nopriv_portfolio_ajax', 'portfolio_ajax');
add_action('wp_ajax_portfolio_ajax', 'portfolio_ajax');

wp_localize_script( 'ajax-stuff', 'ajaxStuff', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );

Now here is the actual ajax.js which is throwing me off. I'm not sure how to simply load the template file into the DOM, so I included an alert to show me whether or not it was retrieving the php template:

(function ($) {
    $(function () {

		$('#all-options').click(function() {
			var data = {
				'action' : 'portfolio_ajax'
			};
			$.post(ajaxurl, data, function(response) {
				alert('Here it is:' + response);
			});
		});
	});
}(jQuery));

So when I click on #all-options, I see an alert which prints the template file as a string. I am happy because this means that the ajax is working, but I'm confused because I don't know how to execute the php on its own and display the results in the DOM. How do I simply execute the action and display the data?

mdgross on "Remove "At a Glance" Theme Name"

$
0
0

I would like to remove the theme name from "At a Glance." The code I was using (see below) stopped working after the WordPress 3.8 update. It appears that this text is no longer filtered by ngettext.

add_filter('ngettext', 'remove_theme_from_dash');

function remove_theme_from_dash($text)
{
	if(preg_match('/Theme.*with.*widgets/', $text))
	{
		return '';
	}
	return $text;
}

I would prefer to remove the text entirely as opposed to hiding it with CSS. Thank you.

pressward on "logging every cookie/session issue in an sql table"

$
0
0

Hi.

As far as I've been able to assess, wordpress does not already do this, am I correct? Authentication state is not logged in mysql, by default?

What is the most efficient way to echo authentication information into an sql table?

I am not asking about actual PHP-SQL code; I would like to know WHERE, in which script file of the out-of-the-box installation would one add the sql insert statement, capturing the session?

TIA

harvey_slash on "Woocommerce Product Separator."

$
0
0

I would like the thousands separator in woocommerce products the 'indian' way:
eg.

10,00,000 instead of 1,000,000.

is there any way this can be done ?

misharnet on "Theme Check problem"

$
0
0

I am creating my first WP Theme and I would like to upload it to wordpress.org. That's why I use, as recommended, Theme Check Plugin.

I resolved other issues, except these two.
1. REQUIRED: The <title> tags can only contain a call to wp_title(). Use the wp_title filter to modify the output

I understand that is related to title tag in header.php, am I wrong?
This is my header:

<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" <?php language_attributes(); ?>> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->

<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><title><?php wp_title( '|', true, 'right' ); ?></title>
	<meta http-equiv="cleartype" content="on">

	<!-- Responsive and mobile friendly stuff -->
	<meta name="HandheldFriendly" content="True">
	<meta name="MobileOptimized" content="320">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<link rel="profile" href="http://gmpg.org/xfn/11" />
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

	<?php wp_head(); ?>
</head>

What is wrong with it?

2. REQUIRED: screen_icon() found in the file class-tgm-plugin-activation.php. Deprecated since version 3.8.

Line 381: screen_icon( apply_filters( 'tgmpa_default_screen_icon', 'themes' ) );

Line 1584: screen_icon( apply_filters( 'tgmpa_default_screen_icon', 'themes' ) );

I understand that, but I don't know with what should I replace it?

I am really greatfull for your potential answers.

blueshark on "Print Button -> print.css"

$
0
0

Hi there,

for each page I want to add a print button. This button makes the site reload with other style sheets, so that is fine for printing.

I am using post name permalink setting, so a link to a page or post looks like http://my-url.de/sample-post/:
<a href="<?php print get_permalink().'?print=true'; ?>" title="Printversion">...</a>

As a fist solution I added just a ?print=true to the link and then check for $_GET['print']:
<?php if( !isset($_GET['print']) || $_GET['print']!=true || !(is_single()||is_page()) ): ?>...

This works fine so far, but it is not a clean solution. When changing the permalink structure this might not work, since it will end in somethink like http://my-url.de/?p=123?print=true

So what might a nice solution for that issue?

Thanks

Blueshark

statushukum on "insert script php"

$
0
0

Anyone know how to insert a php script into themes?


orlisgal2 on "Problem after upgrading to WP 4.1"

$
0
0

Hello -

As soon as I did an auto-upgrade to Wordpress v4.1, I immediately started getting the following pop-up error code: A username and password are being requested by http://customizeyourquit.com. The site says: "WP-Files"

Any ideas on how to fix this?

Thanks -
Katrina

SEO Consulting Charlotte NC on "Calling a MySQL stored proc with wpdb"

$
0
0

I have been developing a plugin and have a need to call a stored procedure which generates several temporary tables and then returns a recordset by selecting 0-n rows from the final temporary table.

After successfully iterating through the recordset returned by the stored procedure, WP is returning "WordPress database error: [Commands out of sync; you can't run this command now]" on the next subsequent query of the DB. I understand that this is because calling a MySQL stored proc from WP actually returns TWO recordsets... the one my stored proc is coded to return plus a second empty recordset. And it is the 2nd empty recordset which is not consumed that is causing the problem with subsequent queries.

I've seen a solution or two offered a while back but they all involve hacking the core (which I absolutely do not want to do).

Is there any way to call a stored procedure using WPDB and iterate through the recordset which it returns without triggering the error: WordPress database error: [Commands out of sync; you can't run this command now]... AND without hacking the WP core?

Thanks in advanced

juzkyte on "Get similar post from taxonomy?"

$
0
0

Can you help me how to get similar posts from current taxonomys in a post?

Thanks a lot...

carriemf on "Can you still access html in 4.1"

$
0
0

hi all,

I'm just trying to access the html of my Wordpress to change an href. A quick no or a yes with marginal explanation would be a huge help. thanks.

adnanasif02 on "unknown link appear in my wordpress site.. Help"

$
0
0

Hi WordPress experts
I have an issue with my wordpress site.
An unknown link appear in my website , i don't know what's happened.
I think that was related with a bad plugin , i disable all my plugins but link still there.
I also change my wordpress theme. but link still there..
here is my website
http://buylxwprot.com/
link is below the header with the name of.. "direct lender installment loans for bad credit"
Please help..
thanks
waiting

Viewing all 8245 articles
Browse latest View live




Latest Images