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

rioforce on "What is "If Modified Since"?"

0
0

Hi,

I have heard about something called "If Modified Since" and it is some type of HTTP header that it is supposed to speed up your site. I have searched a lot, and have contacted Bluehost (my host) and I haven't figured it out. Could somebody tell me what "If Modified Since" is, and how to enable it? I have checked on FeedTheBot and Microsoft, and nobody says I have it enabled.

My web domain is http://whitfieldpineseedlings.com

Thanks!


ndjworldnews on "Sql command needed"

0
0

Hi;
Tried posting this message in Wp-Advanced category but doesn't let me for some reason.

Question: what is the SQL command I need to use to retrieve the last 4 posts from the database?

I am using:

$posts = "SELECT * from $wpdb->posts WHERE post_type='post' ORDER BY post_date DESC LIMIT 4";

That works, except if I don't post anything for one day, that command doesn't pick up anything. How can I do this so that I always have the last four posts, regardless of when I published them?

Thanks for any suggestions.

Lode

msdb88 on "Press This for custom post types"

0
0

Hi,
I've looked hi and low for a "press this" plugin or code that can add information like links and text to a custom post type. The two most promising results have been:
1) http://wordpress.mfields.org/2010/bookmark-this/
2) Press This Custom Post Types

1) the first code logs me off of my site, I'm guessing for some security reason...
2) the second written by the almighty scribu :) seems to be outdated. That code only works if i change:

$link = str_replace('post-new.php', "post-new.php?post_type=$post_type", $link);

to

$link = str_replace('press-this.php', "post-new.php?post_type=$post_type", $link);

which bypasses all of the press this functionality completely.

Is there anyone who has figured this out, or knows why this is such a limited feature?
...Thanks!

Muhammad Rizwan PHP on "Fatal error: Call to undefined function is_user_logged_in()"

0
0

Hi there,

I am developing a Wp Plugin. While using wp_insert_post I got this error:

Fatal error: Call to undefined function is_user_logged_in() in /home/designs/public_html/WP/wp-includes/post.php on line 2185

Here is the file on pastebin: http://pastebin.com/YETGT4dK This file is included in main plugin file. See from line 93

Thank you !

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 = ', ';
}
?>

olddocks on "Theme coding guidelines"

benolding on "jQuery not loading after upgrade"

0
0

Hi -

First, let me say I am in over my head, so apologies in advance if there's a leap in logic here or some other confusion on my part. Any help is appreciated.

I upgraded to the latest version of Wordpress and the custom drop-down menus on our website stopped working. I disabled all the plugins, but that didn't have any effect - the issue appears to be the custom theme we're using.

Ok, that's what I'm sure of. The rest of this is me reading the Internet and trying to make sense of things (sorry in advance if this doesn't make sense).

Looking at the Javascript console in Chrome, I see the following error multiple times:

Uncaught ReferenceError: jQuery is not defined (anonymous function)

So, my conclusion is the theme was loading jQuery in a way that made sense on previous Wordpress versions, but has since been deprecated.

I tried reading about the "right" way to load jQuery with Wordpress, but it sure seems to me the custom theme is doing it correctly (and this is an expression of my ignorance, not confidence). Here's an example code snippet:

function scubanet_init() {
	global $_footer_scripts, $_no_scripts, $_grids, $_ajax;
	if( is_admin() ) $_ajax = 0;
	wp_enqueue_script( 'functions', get_bloginfo( 'template_url' ).'/js/functions.js' );
	wp_enqueue_script( 'jquery' );
	wp_enqueue_script( 'jquery.stageviewer', get_bloginfo( 'template_url' ).'/js/jquery.stageviewer.js', array('jquery','colorbox') );
	if( !is_admin() ) {
		wp_enqueue_script( 'golden_js', get_bloginfo( 'template_url' ).'/golden.js', array( 'jquery' ) );
		wp_enqueue_script( 'hashchange', get_bloginfo( 'template_url' ).'/js/jquery.ba-hashchange.js', array( 'jquery' ) );
		wp_enqueue_script( '_js', dirname( get_bloginfo( 'stylesheet_url' ) ).'/scripts.js', array( 'jquery', 'hashchange' ) );
		add_action( 'wp_print_scripts', 'print_scripts_in_footer' );
	}
	register_taxonomy_for_object_type( 'post_tag', 'page' );

	global $_header_scripts, $_meta;
	$_header_scripts = array( 'jquery', 'jquery.history', 'jw-embedder', 'swfobject' );
	$_meta = apply_filters( '_meta', $_meta );
	wp_enqueue_script( 'comment-reply' );
	$css_url = get_bloginfo('template_url').'/css';
	$css_dir = TEMPLATEPATH.'/css';
	if( file_exists( $css_dir ) && !is_admin() ) {
		$dh = opendir( $css_dir );
		while ( $file = readdir($dh) ) {
			if ( $file != '.' && $file != '..' ) {
				if( $file[0] != '_' ) $csss[] = $file;
			}
		}
		sort($csss);
		foreach($csss as $file) {
			wp_enqueue_style( basename($file), $css_url.'/'.$file );
		}
	}
}
add_action('init','scubanet_init');

These .js files are showing up in the console as having jQuery undefined however.

This code snippet comes from a .php file that is included as the first line of functions.php. It certainly seems like it is the section resulting in the errors in the console view, though I can't be completely confident.

truheart on "Get custom taxonomy terms to be displayed in relative categories?"

0
0

Hi everybody,

Sorry it was really hard to think of a good topic title that would describe what I am going for. So here is the story...

I have set up a taxonomy filter for my client that displays results on the search template. Here is the main part of the code that relates to this question:

<!-- Search Results Container -->
<div id="search-container">
	<?php /* Start the Loop */ ?>
	<?php if( have_posts() ) : while ( have_posts() ) : the_post(); ?>
		<?php // Retrieve Custom Taxonomy Values for Each Attorney.  I.e. their location, position, etc.
			//$location = wp_get_object_terms( $post->ID, 'locations');
			//$bar_admissions = wp_get_object_terms( $post->ID, 'bar-admissions');   <-- UNCOMMENT THESE IF YOU WOULD LIKE TO INTEGRATE THEM INTO THE SEARCH RESULTS.  YOU WILL ALSO HAVE TO EDIT THE SINGLE ATTORNEY SECTION AS SEEN BELOW
			//$languages = wp_get_object_terms( $post->ID, 'languages');
			//$practice_areas = wp_get_object_terms( $post->ID, 'practice-areas');
			//$schools = wp_get_object_terms( $post->ID, 'schools');
			$link = get_permalink();
			$position = wp_get_object_terms( $post->ID, 'positions');
			$position = $position[0]->name;
			$phone = get_field( 'phone_number' );
			$email = get_field( 'email' );
			$vcard = get_field( 'vcard' );
		?>

		<!-- Single Attorney Entry -->
		<div id="attorney-entry">
			<span><a href="<?php echo $link; ?>"><strong><?php the_title(); ?></strong></a></span>
			<span>P: <?php echo $phone; ?></span>
			<span>E: <a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a></span>
			<span><a href="<?php echo $vcard; ?>" download><img src="<?php echo site_url( '/wp-content/themes/rodenolaw/images/vcard_download.png' ); ?>" width="48" height="48" alt="vCard"></a><span>
			<span class="position"><?php echo $position; ?></span>
		</div>
		<!-- /end single attorney entry -->

	<?php endwhile; else: ?>
	<!-- Message if no attorneys are found -->
	<p>Sorry, no attorneys matched your criteria. Please go back to our <a href="our-attorneys">attorney directory</a> and try again.</p>
	<?php endif; ?>
</div>
<!-- /end search results container -->

So I have this configured to display the results in alphabetical order according to custom taxonomy called last-name. Everything is working fine up to this point.

So what my client would like is for the the results page to look something like this: http://www.brunini.com/attorneys-search.html. As you can see, the results are organized and displayed in seperate categories according to the first letter of their last name.

What I already have set up is a custom taxonomy called last-name-latter. What I am looking to do is have the search results page check to see which terms for last-name-letter are showing up from the queried posts (the terms would be A, B, C etc.), then display alphabetical headings for the terms used as well as list the attorneys with the same terms underneath their corresponding headings. It would be easier to understand if you just visit the example site I mentioned.

I am thinking I will have to set up individual divs for every single letter, then use a conditional to display them only if their term shows up in one or more of the queried post. I will have to think through this more, but just seeing if any of you can come up with a clean solution to this.

Thanks ahead of time.


Grahamme on "monitoring mysql database changes"

0
0

I am looking for a code/plugin that can track/monitor mysql changes for wordpress. I tried plugins such as threeWp monitor or WP Security Audit Log but they were loging just certain things like changing passwords adding post etc. I am also planing to use this to track SEO performance when changes are done for a website. Can you suggest me anything?
Thank you.

serviceweb on "Custom registration form"

0
0

Hello, i've create this custom register form

<!-- Row for main content area -->
    <div id="content" class="left eight columns" role="main">
    <div class="post-box">
                    <?php get_template_part('/includes/content', 'page'); ?>
        <div class="wrapper">
<?php
$err = '';
$success = '';

global $wpdb, $PasswordHash, $current_user, $user_ID;

if(isset($_POST['task']) && $_POST['task'] == 'register' ) {

    $pwd1 = $wpdb->escape(trim($_POST['pwd1']));
    $pwd2 = $wpdb->escape(trim($_POST['pwd2']));
    $first_name = $wpdb->escape(trim($_POST['first_name']));
    $last_name = $wpdb->escape(trim($_POST['last_name']));
    $email = $wpdb->escape(trim($_POST['email']));
    $username = $wpdb->escape(trim($_POST['username']));

    if( $email == "" || $pwd1 == "" || $pwd2 == "" || $username == "" || $first_name == "" || $last_name == "") {
        $err = 'Devi compilare tutti i campi obbligatori';
    } else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $err = 'Indirizzo email non valido.';
    } else if(email_exists($email) ) {
        $err = 'Indirizzo email gi&agrave registrato.';
    } else if($pwd1 <> $pwd2 ){
        $err = 'Le password non corrispondono.';
    } else {

        $user_id = wp_insert_user( array ('first_name' => apply_filters('pre_user_first_name', $first_name), 'last_name' => apply_filters('pre_user_last_name', $last_name), 'user_pass' => apply_filters('pre_user_user_pass', $pwd1), 'user_login' => apply_filters('pre_user_user_login', $username), 'user_email' => apply_filters('pre_user_user_email', $email), 'role' => 'subscriber' ) );
        if( is_wp_error($user_id) ) {
            $err = 'Errore in fase di registrazione';

        } else {
            do_action('user_register', $user_id);

        $success = 'You\'re successfully register';
             wp_set_current_user( $user_ID, $current_user );
             do_action('set_current_user');
             $redirect_to = site_url('www.google.it');

             wp_safe_redirect($redirect_to);
        }

    }

}
?>

    <!--display error/success message-->
<div id="message">
    <?php
        if(! empty($err) ) :
            echo '<p class="error">'.$err.'</p>';
        endif;
    ?>

    <?php
        if(! empty($success) ) :
            echo '<p class="error">'.$success.'</p>';
        endif;
    ?>
</div>

<form method="post">
    <h3>Registrati al Portale AlpeAdria</h3>
    <div class="customregistrazione">
    <label class="customregistrazione">Cognome*</label>
    <input type="text" value="" name="last_name" id="last_name" style="width: 50%;" />
    <label >Nome*</label>
    <input type="text" value="" name="first_name" id="first_name" style="width: 50%;" />
    <label>Email*</label>
    <input type="text" value="" name="email" id="email" style="width: 50%;" />
    <label>Username*</label>
    <input type="text" value="" name="username" id="username" style="width: 50%;" />
    <label>Password*</label>
    <input type="password" value="" name="pwd1" id="pwd1" style="width: 50%;" />
    <label>Reinserisci Password*</label>
    <input type="password" value="" name="pwd2" id="pwd2" style="width: 50%;" />
    </div>
    <div class="alignleft"><p><?php if($sucess != "") { echo $sucess; } ?> <?php if($err != "") { echo $err; } ?></p></div>
    <div>Compilando il seguente form di registrazione il cliente accetta quanto previsto nel disclaimer</div>
    <button type="submit" name="btnregister" class="button" >Registrati</button>
    <input type="hidden" name="task" value="register" />
</form>
</div>

    </div><!-- End Content row -->

    <?php get_sidebar( 'right' ); ?>
<?php get_footer();?>

And i want that the user redirect when the registration is ok. Now when visitor make a registration have the succesful message and continue see the form. I like automathic redirect registration to define page http://www.mysite.it/page. Whit my code the form function but not the redirect.

Also i like send an email to subscriber user with details

I try to add this but not function email ($email, "Registrazione OK", "Complimenti registrazione effettuata con successo", "From: email@redacted.com");

Where wrong? How can i resolve?

Thank's

rafsuntaskin on "How to add Upload option in Widget Backend??"

0
0

How Can I add a File Upload option on the Widget admin screen.
So that users can upload a excel file to my widget and I want to save that files url in the $instance variable so that I can use the link to use the file in further process.

rafsuntaskin on "How to add Upload option in Widget Backend??"

0
0

How Can I add a File Upload option on the Widget admin screen.
So that users can upload a excel file to my widget and I want to save that files url in the $instance variable so that I can use the link to use the file in further process.

yudansha47c on "Pictures website"

0
0

Hello guys, I was wondering if it is possible to create a pictures website/blog using wordpress, and what plugings do you suggest ?
The idea of the blog is almost like http://www.memecenter.com in termes of navigation style, where I can browse images using next and previous buttons. While on the home page, will appear the lastest images uploaded.
I came up with an idea of putting every single image on posts, but I'm not sure if it the best way.
Also, is there a way to resize images in the homepage, but they keep their original size in the posts ?
Thank you in advance.
(English isn't my first language nor second :O)

therock775 on "Is my website hacked? So annoying! Please Help"

0
0

So frustrating, first for the past couple months I was getting pop ups all over the place so bad that I couldn't even log in at times. Then in the past couple days I have noticed when I log into my wordpress website to post updates, in the dashboard where I create a new post the screen is just blank white....nothing. Is my site hacked and how can I fix this problem?

Thanks so much :(

wheelz13 on "WordPress Get All Posts With Specific Taxonomy"

0
0

I'm creating a custom PHP script that adds posts to WordPress and allows you to view/modify posts.

The WordPress Theme I'm using has specific post_type, and specific variables to that type.

I can add posts without any issues, but I'm having a difficult time trying to query all posts with the specific tax_input value.

Here is the code that adds posts:

include('../wp-config.php'); //Get WordPress Config
$new_listing = array(
    'post_title'    => $listing_title,
    'post_name'     => str_replace('-', ' ', $listing_title),
    'post_content'  => $listing_description,
    'tax_input'     => array('property-status' => $listing_phase),
    //$listing_phase is the <code>term_id</code> number from what I see in the database
    'post_status'   => 'publish',
    'post_type'     => 'property',
    'post_author'   => 1
);
$listing_id = wp_insert_post($new_listing); //Insert the post into the database
add_post_meta($listing_id, 'REAL_HOMES_banner_sub_title', $listing_subtitle);
add_post_meta($listing_id, 'REAL_HOMES_property_address', $listing_address);
add_post_meta($listing_id, 'REAL_HOMES_property_location', $listing_address_lat.','.$listing_address_lng);
add_post_meta($listing_id, 'REAL_HOMES_property_size', $listing_sqare_foot);
add_post_meta($listing_id, 'REAL_HOMES_property_size_postfix', 'Sq Ft');
add_post_meta($listing_id, 'REAL_HOMES_property_bedrooms', $listing_bedrooms);
add_post_meta($listing_id, 'REAL_HOMES_property_bathrooms', $listing_bathrooms);
add_post_meta($listing_id, 'REAL_HOMES_property_garage', $listing_garage);

What do I need to do to get posts with the same tax_input value?

The below code gets all the properties but with all property-status values, I want to show only a certain properties with certain property-status values:

$postArgs = array('posts_per_page' => 25, 'post_type' => 'property');
$getListings = get_posts($postArgs);
foreach($getListings as $post) : setup_postdata($post);
?>
    <a href="<?=the_permalink()?>" class="deploy-toggle-1"><?=the_title()?></a>
    <div class="content"><p><?=the_content()?></p></div>
<?
endforeach;
wp_reset_postdata();

Thanks in advance!


ScottyDan49 on "Site Hacked - I fear"

0
0

A few days ago, I received a long email from Word Fence saying a bunch of my core files and been changed. Being a newbie, I wasn't sure what it meant or what I should do.

The appearance of my site pjlincoln.com had remained the same until this afternoon. Now, there's no theme showing, no background picture. I was running 2012 as my theme and when this problem popped up, I tried installing a different theme, Writr. But that didn't help.

Wondering if anyone has an idea of what's happened and what I can do to fix it?

Thank you.

alexmoomey on "place short code into html area of lightbox"

0
0

I am trying to put shortcode into a lightbox using it's html capabilities. I can't find any lightboxes that accept short codes from other plugins. I want an image to open in a lightbox and then be able to use an image magnifier inside the lightbox. My short code is

[magny image="http://www.xxx.org/wp-content/uploads/2014/05/201316-260x300.jpg" title="" description="" align="center" click="1" scroll_zoom="1" small_image="" canvas_mode="1" maxwidth="500px" zoom="1" dia="200px" skin="new-im-frame-simple,new-title-off,new-description-below,new-slider-off,new-im-magnifier-simple" ]

and i'm attempting to put that in html section of the lightbox with :

<html>
<?php echo do_shortcode('[above shortcode]'); ?>
</html>

I can get this to work when it's a simple short code that doesn't have options to it. But the one above or any other that include options break.

I probably don't know about code as much as I need to attempt this but am i on the right track?

everyeurocounts on "add page template by name"

0
0

i am adding templates from a plugin and want to create a page from the plugin as well, which works but i have issues with the correct template being applied. According to the codex, wp_insert_post template=> templatename.php which is probably looking in the theme for a template file.

Is there anyway around this?

function create_pages() {

	$templates= array(
	//name=template
	'Advert-Payment' => 'ad-payment-screen'

	);

	foreach ($templates as $name=>$template) {
		if(get_option($name)===False) {
			$post= array(
					'post_title'    => $name,
					'post_name' =>$name,
				 	'post_status'    => 'publish',
  					'post_type'          => 'page',
  					'post_content'  => '',
  					'post_author'   => 1,
  					'page_template' => $template

			);

			$postid=wp_insert_post( $post );
			add_option( $name, $name );
		}

	}
}

add_action('wp_loaded', 'create_pages');

dancingbay on "Reading a CSV file???"

0
0

I use WordPress and Cart66 to run an online store. One of my blanks vendors has a CSV online that contains the the SKU, Description, Qty in Stock, and Custom Status.

I'm interested in pulling out the last 2 fields of the SKU for what ever page my customer is on, so that I have an up to date quantity that can be ordered and any information on when out of stock items will be back in stock.

I've searched all the ways I can think of for a plugin or hack that will do this, but so far have only found plugins that make it easier to manually load csv files, but not any that will allow the website to directly read/load the csv file from a URL.

A while back, I wrote a little PHP script that would read a csv file from a URL and parse the data, but don't have a clue how to integrate that into WordPress.

Any ideas or advice would be greatly appreciated.

Thanks,
Alisa

currywurst on "Edit Pages widget"

0
0

Hi,

I would like to create a sidebar menu from the Pages widget of WordPress. I looked into the widgets.php, but could not find the part which generates the pages HTML code.

To be more specific I would like to remove the "Pages" title of the widget. (So it would consist of the links only)

Could you please help finding out where to modify the php?

Thanks,

Viewing all 8245 articles
Browse latest View live




Latest Images