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

Isidoros Rigas on "How to disable images? (0.domain.com)"

$
0
0

Hello world,

I have a techblog and I want to create an image-free version, something like 0.domain.com like 0.facebook.com, because I usually use large images. My friend complained that his data (30MB) "dried up" quickly while he browsed Fb and my blog. So, how can I do it if I keep the same theme? Do you think it worths trying?

Thanks in advance.


_F12 on "Changing displayed post"

$
0
0

I'm sure there is a way to do this but I can't figure it out. I want to display a post based on variables that I gather (from GET and $wpdb) rather than using a permalink - i.e. the same URL would produce a different post depending on the circumstances. Is there a way to do this such that I don't need to change a great deal of code in the displaying of the post (i.e. I can still use the standard .php files with the_title, the_content etc., but just with an added function somewhere to change the post which all the functions refer to)?

So I could display the posts the usual way (with permalinks), but also have another page which works out which post to show the viewer based on some internal logic rather than solely based on the URL?

JDAsbill on "Wordpress Media Player"

$
0
0

Where could I find the files govern and style the Wordpress Media Player?

Roman.L on "Applying "Attachment Display Settings" to all selected images"

$
0
0

When you editing Post or Page you can select Add Media button then if you have images uploaded already you can click on one an use either CTRL+LMB or SHIFT+LMB to select multiple images.

Once you select them you can edit "Attachment Display Settings" on right side, however its only works for once image at a time. Is there solution to apply same setting to all selected images?

pythonidea on "how to add visual composer button in custom post type"

$
0
0

Hi, in my wp general post, it shows the visual composer's button... now I have a custom post type but the visual composer's button didn't shows up...

does anyone have an idea about this?

datainterlock on "Plugin not loading language files"

$
0
0

I'm using code from the plugin boilerplate

public function load_plugin_textdomain() {
		$domain = $this->plugin_slug;
		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );

		load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
		load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );

	}

I've created es_ES.po and .mo files and they look good. Poedit is set to compile automatically. I've changed the language in my config.php to es_ES. I've downloaded the WordPress 3.9 es update. I've check paths, file names, and I'm about to pull out what little hair I have left.

1. It did NOT move my language files when I upgraded WordPress to 3.9 es so the load_textdomain isn't finding them in the new /language/ directory. Why it didn't move them, I have no idea.

2. load_plugin_textdomain does nothing. it's still constantly in English no matter what I do.

3. I've read the codex, other websites and a few religious pamphlets and STILL can't get the language to load.

any ideas?

DatagoniaWeb on "Modifying the Main Loop Query (wp_query->set)"

$
0
0

Good Morning,

I am currently building a website that will be a blog about music and am implementing custom fields and custom post types in several different manners. On my archive-event.php page I specifically want to modify the main loop for that page so that instead of ordering by the date the post (each event is a post of type "event") was published I want them sorted in the archive by the date of a custom field called "start_date".

Currently each start_date field is in the form "yyyy-m->set-dd" and I want to omit posts with a start_date before the current date (so previous events would not show up). Additionally I would like to order the archive of the posts by start_date so that the first post would be the soonest upcoming event.

I was reading a little bit about the pre_get_posts function but was not able to implement it correctly. The two main areas of code for attempting to modify the query are in functions.php and archive-event.php:

Functions.php:

//specifically alter the main query *after* it has been called
add_action('pre_get_posts','alter_events_query');
function alter_events_query($query){
      if( $query->is_main_query() ){
        $query->set( array('meta_key' => 'start_date', 'meta_value' => date('o-m-d'), 'meta_compare' => '>=' ));
      }
}

Event-archive.php:
alter_events_query( );

It should be noted that the "alter_events_query();" line is called immediately after the "get_header" call at the beginning of archive-event.php.

My website is: RaveIsKing.Danconia.US and the page, including error message, is the following (debugging is currently on):
http://raveisking.danconia.us/event/

Any help that could point me in the right direction would be appreciated. I don't know if I am sending the right parameters to the wp_query->set method and it seems that documentation on that method and the "pre_get_posts" isn't very well documented either. Thank you!

mojwp on "How to display the number of unique commenters"

$
0
0

Hello. Could you tell me, how can I display the number of unique commenters on the simple page of my website without a plugin? I want to show how many different commentators wrote on my website. Thanx.


TBean on "Twenty Twelve comment badges for Admins and Editors"

$
0
0

Hi all,

I copied twentytwelve_comment() from the functions.php to my child theme to include a "Moderator" badge beside the name if the person commenting is a site admin or editor.

I have this but it only adds badges to the post authors.

printf( '<cite><b class="fn">%1$s</b> %2$s</cite>',
	get_comment_author_link(),
	// If current post author is also comment author, make it known visually.
	( $comment->user_id === $post->post_author ) ? '<span> ' . __( 'Moderator', 'twentytwelve' ) . '</span>' : '');

I found this snippet but I don't know how to integrate it into the code above.

<?php
   $commentator_id = get_comment(get_comment_ID())->user_id;
   $commentator_info = get_userdata($commentator_id);
   $capabilities = $user_info->wp_capabilities;
   if (array_key_exists('editor', $capabilities)) {
      // echo markup here
   }
?>

Source

I'm hoping someone can show me how to get the first code to work for admins and editors too. Any help is appreciated! Thanks!

dubenenmail.ru on "changed widget.php site is unavailable. What to do?"

$
0
0

tried to insert a piece of code in vidzhet.php authorization through social networks. overlooked and put in the beginning of the file, immediately after the first to comment. Now the site is unavailable. Thoughts zero. Help please

daniel22222 on "custom login page only allowing admin login"

$
0
0

I created a custom login page, but it only seems to allow me to login as the admin. My blog allows people to signup and comment on posts, but this login page does not allow normal users to login. Is there a different function for this purpose?

if($_POST){
//We shall SQL escape all inputs
$username = $wpdb->escape($_REQUEST['username']);
$password = $wpdb->escape($_REQUEST['password']);
$remember = $wpdb->escape($_REQUEST['rememberme']);

if($remember) $remember = "true";
else $remember = "false";
$login_data = array();
$login_data['user_login'] = $username;
$login_data['user_password'] = $password;
$login_data['remember'] = $remember;
if ($username == "" || $password == "") {
	if ($username == "") {
		echo "<b>ERROR:</b> Invalid username.";
		exit();
	} else {
		echo "Login failed, your password cannot be left blank.";
		exit();
	}
}
$user_verify = wp_signon( $login_data, true);
//var_dump($user_verify);
//exit();
if ( is_wp_error($user_verify) )
{

   echo  "<span class='error'>".$user_verify->get_error_message()."</span>";
   exit();
 } else
 {
   echo "<script type='text/javascript'>window.location='". get_bloginfo('url') ."'</script>";
   exit();
 }
}

nooteboom on "Add "Read More" smart tag to every non latest post"

$
0
0

In my blog I would like the latest post to show all of the text and every other post to show x-number of characters and the "read more" link to show up. I'm using the twentytwelve theme.

dubenenmail.ru on "изменил виджет.php сайт недоступен. что делать?"

$
0
0

пытался вставить кусок кода в виджет.php для авторизации через соц сети. проглядел и вставил в самом начале файла, сразу после первых комментов. теперь сайт недоступен. Мыслей ноль. Помогите пожалуйста

Sampie on "adding slider to mandigo header"

$
0
0

Hallo, i am using the mandigo thema on my site http://www.sample.com i want to have a slider in My header that shows a different image every 5seconds. I have no knowledge in PHP so iminstalled a plug-in, but i have to put in one line op PHP code. The probleem is i dont know where to put It. I tried couple of times but none worked. I hope someone can help me.

The code i have to implement:
'<?php if ( function_exists( "easingsliderlite" ) ) { easingsliderlite(); } ?>'

My header.PHP:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<title><?php
$title = '';

if (is_single() ) $title = get_option('mandigo_title_scheme_single');
elseif (is_page() ) $title = get_option('mandigo_title_scheme_page');
elseif (is_archive()) {
if (is_day() || is_month() || is_year()) $title = get_option('mandigo_title_scheme_date');
else $title = get_option('mandigo_title_scheme_category');
}
elseif (is_search() ) $title = get_option('mandigo_title_scheme_search');
else $title = get_option('mandigo_title_scheme_index');

$title = str_replace('%blogname%',get_bloginfo('name') ,$title);
$title = str_replace('%tagline%' ,get_bloginfo('description'),$title);
$title = str_replace('%post%' ,get_the_title() ,$title);
$title = str_replace('%search%' ,$s ,$title);

if (single_cat_title('',false)) $title = str_replace('%category%',single_cat_title('',false) ,$title);
else $title = preg_replace("/<[^>]+>/","",str_replace('%category%',get_the_category_list(', '),$title));

if (is_day() ) $title = str_replace('%date%',get_the_time(__('l, F jS, Y','mandigo')),$title);
elseif (is_month()) $title = str_replace('%date%',get_the_time(__('F, Y','mandigo')) ,$title);
elseif (is_year() ) $title = str_replace('%date%',get_the_time('Y') ,$title);

echo $title;
?></title>

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
<meta name="theme" content="Mandigo <?php $themes = get_themes(); echo $themes['Mandigo']['Version']; ?>" />

<?php
if (get_option('mandigo_scheme_random')) {
$schemes = array("blue","red","green","pink","purple","orange","teal");
update_option("mandigo_scheme",$schemes[array_rand($schemes,1)]);
}
if (get_option('mandigo_bold_links')) { $lastminutecss .= " a { font-weight: bold; }\n"; };
if (file_exists(TEMPLATEPATH.'/images/headers/'. $post->ID .'.jpg')) {
$noheaderimg = 1;
$lastminutecss .= " #headerimg { background: url(". get_bloginfo('stylesheet_directory') ."/images/headers/". $post->ID .".jpg) bottom center no-repeat; }\n";
}
elseif (get_option('mandigo_headers_random')) {
$headersdir = opendir(TEMPLATEPATH.'/images/headers/');
while (false !== ($file = readdir($headersdir))) {
if (preg_match("/\.(?:jpe?g|png|gif|bmp)$/",$file)) $headers[] = $file;
}
if (sizeof($headers)) {
$noheaderimg = 1;
$lastminutecss .= " #headerimg { background: url(". str_replace(' ','%20',get_bloginfo('stylesheet_directory')) ."/images/headers/". $headers[array_rand($headers,1)] .") bottom center no-repeat; }\n";
}
}
$stroke = get_option('mandigo_stroke');
?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>.php<?php echo ($noheaderimg ? '?noheaderimg' : '') ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/<?php echo get_option('mandigo_scheme'); ?>.css" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php
wp_head();
if ($lastminutecss) echo "<style type=\"text/css\">\n$lastminutecss</style>\n";
echo get_option('mandigo_inserts_header');
?>

</head>
<?php
$bodytag = get_option('mandigo_inserts_body');
echo (preg_match("/<body/i",$bodytag) ? $bodytag : "<body>");
?>

<div id="page">

<div id="header">
<div id="headerimg">
<?php if (!get_option('mandigo_hide_blogname')): ?>
<h1>/"><?php bloginfo('name'); ?></h1>
<?php if (get_option('mandigo_drop_shadow')): ?>
<span class="h1 text-shadow"><?php bloginfo('name'); ?></span>
<?php endif; ?>
<?php if ($stroke): ?>
<span class="h1 text-stroke-tl"><?php bloginfo('name'); ?></span>
<span class="h1 text-stroke-tr"><?php bloginfo('name'); ?></span>
<span class="h1 text-stroke-bl"><?php bloginfo('name'); ?></span>
<span class="h1 text-stroke-br"><?php bloginfo('name'); ?></span>
<?php
endif;
endif;
if (!get_option('mandigo_hide_blogdesc') && get_bloginfo('description')):
?>
<div class="description">
<h6><?php bloginfo('description'); ?></h6>
<?php if (get_option('mandigo_drop_shadow')): ?>
<span class="h6 text-shadow"><?php bloginfo('description'); ?></span>
<?php endif; ?>
<?php if ($stroke): ?>
<span class="h6 text-stroke-tl"><?php bloginfo('description'); ?></span>
<span class="h6 text-stroke-tr"><?php bloginfo('description'); ?></span>
<span class="h6 text-stroke-bl"><?php bloginfo('description'); ?></span>
<span class="h6 text-stroke-br"><?php bloginfo('description'); ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<ul class="pages<?php echo (get_option('mandigo_headoverlay') ? ' head_overlay' : ''); ?>">
<li class="page_item">/"><?php _e('Home','mandigo'); ?>
<?php wp_list_pages('sort_column=menu_order&depth=1&title_li=&exclude='.get_option('mandigo_exclude_pages')); ?>
<li class="page_item">Van alles wat
<li class="page_item">Vakanties
<li class="page_item">Huis en tuin
<li class="page_item">Hardlopen

</div>

</div>
<div id="main">
<?php get_option('mandigo_inserts_top'); ?>
<table>
<tr>
'

Thanx in advance

dp95000 on "Lizard Themes Contact Form Redirect"

$
0
0

Hello Everyone,

First time user here, hoping to utilize this forum as a valuable tool to help me, as I work with several Wordpress clients for a living. I'm doing some work for a client who has a theme installed on his site, from Lizard Themes. What I'm trying to do is to get his contact form to redirect to a thank you page after submission. This contact form is an element that comes packaged with the theme itself and is not a separate plugin, as far as I know (so this is outside my usual experience). I've already browsed the settings but I don't see any option to allow me do redirects and I've also already contacted Lizard Themes but they don't provide code editing services to individual users. They did, however, inform me that I would need to open the file 'feedback.php' and modify the following code:

<form action='' method='POST'>
<div class='uDetail'><span><?php _e('Name', 'lizard'); ?>:</span><div class='input'><input type='text' name='uName' value='' /></div></div>
<div class='uDetail'><span><?php _e('Email', 'lizard'); ?>:</span><div class='input'><input type='text' name='uEmail' value='' /></div></div>
<div class='uDetail'><span><?php _e('Subject', 'lizard'); ?>:</span><div class='input'><input type='text' name='uSubject' value='' /></div></div>
<?php if ( count($feedback['department']) > 1 ) { ?>
<div class='uDetail'><span><?php _e('Department', 'lizard'); ?>:</span><div class='input'><select name='uDepartment'>
<?php foreach( $feedback['department'] as $department ) { ?>
<option value="<?php echo $department['title']['value']; ?>"><?php echo $department['title']['value']; ?></option>
<?php } ?>
</select></div></div>
<?php } ?>
<div class='uDetail'><span><?php _e('Message', 'lizard'); ?>:</span><div class='input'><textarea name='uMessage' rows='8'></textarea></div></div>
<input type='submit' value='<?php _e('Send', 'lizard'); ?>' />
<div class="clear"></div>
</form>

FYI, I'm an entry-level developer and I'm proficient with the wordpress interface overall, plus I know HTML, CSS, and little bit of PHP. If anyone can tell me what code I need to change, I would greatly appreciate it. Thanks.

PS. This is the site I'm working on... http://kahnattorneysinisrael.com/


thewatcheruatu on "adding action hook to rss feed"

$
0
0

I'm confused about something and I'm wondering if somebody can give me some insight. If I'm not mistaken, WordPress uses feed-rss2.php in the wp-includes folder to generate the RSS 2.0 feed. So I checked out that file and found this:

<?php
	/**
	 * Fires at the end of each RSS2 feed item.
	 *
	 * @since 2.0.0
	 */
	do_action( 'rss2_item' );
	?>

So my understanding is that in my theme's functions.php, I should be able to hook a function onto that like so:

function myrss_function() {
	echo '<mynodename>stuff</mynodename>';
}

add_action ('rss2_item', 'myrss_function');

I've done that, however nothing at all changes at http://mysite.com/feed/

So what I did was actually directly edit feed-rss2.php and hard code a dummy node in there, and still nothing changes when I view my site's feed. So I don't get it--is WP actually using something else to generate that feed output? I tried clearing my cache and using different browsers thinking it might have just been a caching issue, but it is the same result every time.

Satrya on "category__in issue?"

edow on "Category sidebar seach: checkbox and custom fields problem"

$
0
0

Hi,

I'm struggling with the following problem for a while. It's almost working, but still not yet. First of all, sorry for my bad English.

I made this sidebar search form (see code below) for my category page to filter the search results based on the tags which are available within the category.

The first part is working great when I use radio buttons, but I want the form to remember mulitple checkbox fields. Someone suggested name="tag[]" but that's not working unfortunately. When I use name="tag" the url output is /?tag=test&tag=test2 instead of /?tag=test,test2 so it won't work properly.

The next problem. I use this function to make a url parameter based on a custom field, but I can't figure out how to use it with multiple keys.

function wpa_filter_home_query( $query ){
    if( $query->is_main_query()
    && isset( $_GET['provincie'] ) ) {
        $meta_query = array(
            array(
                'key' => 'provincie',
                'value' => array( $_GET['provincie'])
            )
        );
        $query->set( 'meta_query', $meta_query );
    }
}
add_action( 'pre_get_posts', 'wpa_filter_home_query' );

And the last problem is that I want to show only keys from custom fields under <h3>Land</h3> and <h3>Regio</h3> just like the code only shows tags which are used. I also can't figure out how to let this work for the custom fields.

The form:

<form name="tags" onChange="document.forms.tags.submit();">
		<?php
		if (is_category()){
		  $cat = get_query_var('cat');
		  $yourcat = get_category ($cat);
		}
		$tag_IDs = array();
		query_posts('category_name='.$yourcat->slug);
		if (have_posts()) : while (have_posts()) : the_post();
		  $posttags = get_the_tags();
		  if ($posttags):
			foreach($posttags as $tag) {
			if (!in_array($tag->term_id , $tag_IDs)):
			   $tag_IDs[] = $tag->term_id;
			   $tag_names[$tag->term_id] = $tag->name;
			   $tag_slug[$tag->term_id] = $tag->slug;
			 endif;
			}
		  endif;
		endwhile; endif;
		wp_reset_query();

		if (!empty($tag_IDs)){
			echo '<h3>Het meest geschikt voor</h3>';
			echo "<input type=\"checkbox\" name=\"tag\" value=\"\"> Show all<br>";
		}
		foreach($tag_IDs as $tag_ID){
			$checked = $tag_slug[$tag_ID];
			echo '<input type="checkbox" name="tag" value="'.$checked.'"' ;
			if((isset($_GET["tag"])) && $_GET["tag"] == $checked) {
			echo ' checked="checked"';
			}
			echo '> '.$tag_names[$tag_ID].'<br>';
		}
		?>

		<div class="margin25px"></div>

		<h3>Land</h3>
			<input type="radio" name="land" value=""> Alles weergeven<br>
			<input type="radio" name="land" value="nederland" <?php if((isset($_GET["land"])) && $_GET["land"] == "nederland") { echo "checked";}?>> Nederland<br>
			<input type="radio" name="land" value="belgie" <?php if((isset($_GET["land"])) && $_GET["land"] == "belgie") { echo "checked";}?>> Belgie

		<div class="margin25px"></div>

		<h3>Regio</h3>
			<input type="radio" name="provincie" value=""> Alles weergeven<br>
			<input type="radio" name="provincie" value="gelderland" <?php if((isset($_GET["provincie"])) && $_GET["provincie"] == "gelderland") { echo "checked";}?>> Gelderland<br>
			<input type="radio" name="provincie" value="overijssel" <?php if((isset($_GET["provincie"])) && $_GET["provincie"] == "overijssel") { echo "checked";}?>> Overijssel
		</form>

Hopefully someone can give me some hints to make this work. It's a great category search form if it's working properly. Sorry if I ask to many questions, but it's all related to each other since it's all meant to make the sidebar filter function work.

Pete on "How to exclude the current term from all the terms?"

$
0
0

This piece of code is in my custom taxonomy template taxonomy-driver-training-school.php. It displays ALL the terms of the specified taxonomy, but how can I make it exclude the current term?

How do I exclude the current term

<?php
$driver = get_terms('driver-training-school','hide-empty=0&orderby=name&order=asc&exclude=????????');
$sep = '';
foreach ( $driver as $driver ) {
if( ++$count > 999 ) break;
echo $sep . '<a href="'.get_term_link($driver).'">'.$driver->name.'</a>';
$sep = ', ';
}
?>

brendan on "Reusing a submenu on a dropdown?"

$
0
0

Does anyone know if any plugin or script exists to take a parent menu's dropdown, and use that as an element elsewhere on the page?

for example, you have a menu that display this when you hover over one of the items:
http://i.imgur.com/978fuWi.png

And on the actual page you re-use that dropdown menu on the top as another way for the user to explore your page's parent/children, it'd be something like this:
http://i.imgur.com/s3rHLtD.png

Right now I'm using a script that displays the page's parent and all it's children, as opposed to grabbing a sub-menu - the only problem with this method is that it doesn't list them in the same order as in the menu, it alphabetizes the items automatically.

The best way my friend came up with so far is making a new template and menu for every single page. Seems like an extraordinary amount of work for something potentially so simple!

I hope this makes sense, I can clarify more if needed!

Viewing all 8245 articles
Browse latest View live




Latest Images