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

yerlix on "custom message on quick edit"

$
0
0

On my site, I check if an array doesn't exceed 3 values. Now I want to doe this as well on the quick edit form.

So far, I get the message only when I refresh the browser.

The code I use when I save the quick edit:

if ( array_key_exists( 'speciality', $_POST ) ){
			    // update_post_meta( $post_id, 'med-spec', $_POST[ 'speciality' ] );
			    // inlezen specialiteiten
		        $specs = preg_split("/[\s,]+/", $_POST['speciality']);

		        // check of er maximum 3 ingevuld zijn
		        if (count($specs) < 4){
		            update_post_meta( $post_id, 'med-spec', $_POST[ 'speciality' ] );
		        } else {
		            $_SESSION['my_admin_notices'] = "<div class='error'><p>Maximum 3 specialiteiten!</p></div>";
		            return false;
		        }
			}

The code above checks if the array is maximum 3 values long and puts a message in the session when it is not.

On my page I recall the session:

function my_admin_notices(){
        var_dump($_SESSION['my_admin_notices']);
        if(isset($_SESSION['my_admin_notices'])) {
            print  $_SESSION['my_admin_notices'];
        } else {
           $value = '';
        }
        unset($_SESSION['my_admin_notices']);
    }
    add_action( 'admin_notices', 'my_admin_notices' );

But this shows the message only on refreshing the browser.

Is there a hook for this? Or must this be done through javascript?


fikrirasyid on "Google Analyticator doesn't display dashboard widget"

$
0
0

I successfully installed Google Analyticator on local server but when I use it to actual site, I found a weird bug. Here's how it goes:

- I'm using subdomain multisite installation
- The plugin runs well on the main site
- The plugin won't display the dashboard widget on the sub-site.

For the time being, the clue I have is there's this error when i'm checking Chrome's console: "Uncaught ReferenceError: datelabel is not defined" message on the index.php (I think the plugin injects an inline js on the body".

Thank you for your help guys.

r0bbbb on "Facebook like button with iframe code IN header, how to make it responsive?"

$
0
0

Hi Guys,

As my website doesnt include any sidebar on the homepage i was 'forced' to add the iframe facebook code for like button to my header.php.

However, when I got this working, I found out by opening my site on mobile phone, that this FB like button isnt responsive yet (Its BIG on mobile).

I found some answers to this matter by wrapping the FB code into a <div>, however this doesnt work for me (maybe cause Im coding into my header instead of a normal widget?)

Would be great if someone could help me out!

Thanks in advance,

r0bbbb.

sonamlucky on "Private Site Members Plugin"

$
0
0

Using the Redirect all logged-out users to the login page before allowing them to view the site option.
But would like them to register as well, but it seems block the sign up page as well.
Any Help would be appreciated.
Thanks

https://wordpress.org/plugins/members/

Julien on "taxonomies not open with capabilities"

$
0
0

Hello,

I encounter different problems with my plugin. Indeed, I would like to create a stable plugin but a lots of things happend...

Lets see my code : http://pastebin.com/y52g8i2Y

When I connected as "customer" or as admin, I can see that, 3 metabox doesn't work correctly and I can't see on left menu, category, targs, voyage and technical !

http://i55.servimg.com/u/f55/12/75/44/40/wp-tax11.jpg

Thanx for u explanation and your patience.

gianny on "Apply filter by IPTC metadata in image store plugin"

$
0
0

Hi,
i use a Image Store plugin (http://wordpress.org/plugins/image-store/) and i want to apply a filter based on metadata "credit" in the photo display in the front end.

Example: I would like to display only photos that have metadata "credit = 000"

Could someone tell me how and where i can apply this filter?

Thank you very much!

Gianni

geophray on "Changing type of custom permalinks"

$
0
0

I am trying to find out if there is a plugin or hack or SOMETHING that will allow me to change from one version of the custom permalinks to another without losing my google link juice... The permalink structure was selected before I was around and it is not really helping our search ranking.

I'd like to change from the Numeric (/archives/%post_id%) to the Post name (/%postname%/) permalinks. I know the default always works regardless of the custom structure that is selected, but that doesn't help in this particular situation, as I'm not using the default structure.

If anybody knows of a way to do some kind of rewrite that would redirect one type of permalink to the other it would be greatly appreciated. I have full access to the server and am running NGINX if that helps.

Neilaj on "Selling Videos w/WP"

$
0
0

Hello all, I am trying to build a site where I can sell an online video course. Can anyone give me an idea of how to accomplish this?
Thanks.


almerika on "Hide buy button on products with specific tags WP E-commerce"

$
0
0

Hi.
Using WP E-commerce and Storefront Elegance theme for an online store. Trying to use a product tag as a condition to hide the buy-button and quantity update (on the single product page) for some products that only can be bought in the physical store (can't be shipped).

I've tried with css and it works fine but only on one specific product (post-1928) and not on a whole product tag.

Here's the css:
.post-1928.wpsc-product.type-wpsc-product .wpsc_quantity_update {
display: none;
}
.post-1928.wpsc-product.type-wpsc-product .productcol fieldset legend {
display: none;
}
.post-1928.wpsc-product.type-wpsc-product input.wpsc_buy_button {
display: none;
}

Here's the test-product: http://www.olsonsab.se/produkter/tillbehor/testprodukt-2/
Here's the product tag: http://www.olsonsab.se/etikett/demoex/

I've also tried a php code in the wpsc-single_product.php that hides the buy button if you're not logged in.

<?php if((get_option('hide_addtocart_button') == 0) && (is_user_logged_in()) && (get_option('addtocart_or_buynow') !='1')) : ?>

That example works good but I don't know what to put in instead to use the function for products with a specific tag. The tag is "demoex" (term-134).

Would really appreciate some help here. I've been searching for days.

Christiaan Conover on "TinyMCE 4.0: specifying buttons to display"

$
0
0

Maybe I'm just clueless, but in looking through the documentation for TinyMCE 4.0 I can't seem to find information how how to specify which editor buttons to display. The theme_advanced_buttons[n] argument that works fine in TinyMCE 3 doesn't appear to be supported in version 4, and I can't find information on the replacement argument. Can anyone point me in the right direction?

LittleBigThing on "display 'activities' custom post type odered by activity date"

$
0
0

Hi,

I am using the following code to display my custom post type 'activities'. It works and displays them ordered by activity date (meta data) and only the future (and today) activities are displayed:

$yesterday = time() - 86400;

$args = array(
'post_type' => 'activities',
'posts_per_page' => -1,
'meta_key' => 'date_activity',
'orderby' => 'meta_value_num',
'order'	=> 'ASC'
);
$act_query = new WP_Query( $args );

if ( $act_query->have_posts() ) : ?>
<?php while ( $act_query->have_posts() ) : $act_query->the_post(); ?>

<?php $activity_date = get_post_meta( $post->ID, 'date_activity', true );

if ( $activity_date > $yesterday ) : ?>

<?php get_template_part( 'content', 'activities' ); ?>

<?php endif; ?>

<?php endwhile; ?>

<?php wp_reset_postdata(); ?>

<?php endif; ?>

It works but I cannot really use paging and 'posts_per_page' directly on it since it extracts all posts: also the older ones, it only won't display them. I found a possible solution using meta_compare but I won't get it working like this:

$yesterday = time() - 86400;

$args = array(
'post_type' => 'activities',
'posts_per_page' => -1,
'meta_key' => 'date_activity',
'meta_value' => $yesterday,
'meta_compare' => '>'
'orderby' => 'meta_value_num',
'order'	=> 'ASC'
);
$act_query = new WP_Query( $args );

if ( $act_query->have_posts() ) : ?>
<?php while ( $act_query->have_posts() ) : $act_query->the_post(); ?>

<?php get_template_part( 'content', 'activities' ); ?>

<?php endwhile; ?>

<?php wp_reset_postdata(); ?>

<?php endif; ?>

Anyone any idea why it won't work? It displays actually all 'activities' for some reason...
Thanks a lot!

Prerak Trivedi on "Want to add nofollow and dofollow check box in add link dialog box."

$
0
0

Hello experts.

I was watching a video of Matt Cutts about nofollow and dofollow relations. He stated that every outbound link shouldn't be as nofollow. Sharing PR juice is good too. So I got an idea to add this features into add link dialog box so people won't have to add it through HTMl code parameters. Plus it would be in Advanced tab so normal users have it off their sight.

Please guide me to start.
Question 1 : Where I can find the code of this dialog box?
Question 2 : Will there any problem while updating wp?
Question 3 : Can I inject it through function.php?

I really appreciate everybody's time so please if you know any tutorial or any link that could guide me, it will help me as of now. I will then try to dive into the depth and post incase I'll have any specific problem.

Thank you very very much.
Regards,
Prerak.

localsports on "HTML/CSS Help"

$
0
0

I installed a plugin that has a front end editor. I am trying to make the edit box that the plugin uses longer. (the text area where a user would input his/her post.

Be default, it appears that it is set to only 100px. I would like to make the default 500px.

I think this is the code where the default height is located:

<iframe id="new-post-desc_ifr" src='javascript:""' frameborder="0" allowtransparency="true" title="Rich Text Area Press ALT F10 for toolbar. Press ALT 0 for help." style="width: 100%; height: 100px; display: block;"></iframe>

So in my Quick CSS box I put:

.new-post-desc_ifr {
height: 500px;
}

and then I also put it in as an id selector:

#new-post-desc_ifr {
height: 500px;
}

but neither will work. Any help would be appreciated.

bantin on "image in front of page"

$
0
0

I'm looking for a way to add an image to the front of my website.

I have an image that's like a picture frame with a transparent center. I'd like a way to put it on top of my site such that the site contents (text blocks, images, videos, etc.) scroll behind it. It would be kind of like looking at the site through a window.

The frame would be fixed like a background image, but the content of the page would scroll behind it.

Any ideas?

Thanks

rantsofatwinkie on "Remove 'Rating' box from Add New Post for all users"

$
0
0

Hi! There is a 'Rating' section to a Add New Post interface that can be hidden via the "Screen Option" checkboxes. However, we'd like to have it hidden for all users so that they don't have to use the Screen Option checkbox. Is there a way to accomplish this? I have searched high and low and have not found anything so far.

Thanks!
-Rich


acosmin on "Exclude category from the main RSS feed and also keep that category feed"

$
0
0

If you want to exclude a category from the main RSS feed and also keep that category rss feed use the following code:

function ac_exclude_from_rss($query) {
    // Categories to exclude - by ID
    $cats_to_exclude = array( 15, 16);

    if ($query->is_feed && !$query->is_category($cats_to_exclude) ) {
        set_query_var('category__not_in', $cats_to_exclude);
    }

    return $query;
}
add_filter('pre_get_posts','ac_exclude_from_rss');

If someone has something to add please share :)

help me joe n on "RSS feed hacked ?"

$
0
0

Hi all,
I am by know means even a novice at this so Please treat me as a dummy..
I built a mobile app that draws my rss feed from my website and for some reason I get a spam viagra clip attached to my 1st news feed.. any help would be much appreciated.
Thank you in advance

aritrea on "Bug? Session data not being saved correctly?"

$
0
0

hi there,

I am using latest wordpress 3.8.1 to deploy a site and I use SESSION variables to store some information. Anyway, I get a really strange behaviour which I could reduce to the attached code snippet below.

let me describe what I want to do:
- depending on a test() function, i want to set a session variable with a random number
- if the test function fails (returns false), all session data shall be unset by using session_unset()
- by refreshing the page (thus the test-function returns true again), another pseudo-random number should be generated and saved to the session.
- a var_dump of my session just before should therefore display the OLD random number which has just been set

what I get:
- it does NOT display the old random number, but unsets the whole session array

the following steps make it work as expected, but - of course - are not an option with my website:
- removing wordpress related stuff like wp_head and so on to make it look like a usual non-wordpress php site
- simply returning "true" in my test function (anyway, var_dump of this function also returns true)
- uncomment session_unset() - line
- remove bloginf() call => works with chrome on mac (does NOT work with firefox on mac?!?!)
- remove bloginfo() AND wp_head() call => works with firefox as well

another strange thing: removing some lines work with chrome, but not with firefox. its quite late, so I might just miss a huge thing here, but how does the browser affect php's execution?!?!

I'm really confused and dont know how to fix this issue..
Anyway, here is the code ive been talking of. feel free to play with it.

best regards,
Christoph

<?php
session_start();

function test() {
	// return true; // this works, too!!
	$val = (isset($_GET['action']) && $_GET['action'] == "support");
	return $val;
}

?>
<!DOCTYPE html>
<html>
	<head>
		<?php
		// Chrome: remove bloginfo()
		// Firefox: remove wp_head() && bloginfo()
		?>
		<?php //*  ?>
		<?php wp_head(); ?>
		<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
		<?php // */ ?>
	</head>
	<body>
		<div style="text-align: center">
			<h1>
				Session
			</h1>
			<div>
				<?php
				var_dump($_SESSION);
				?>
			</div>
		</div>
		<div id="main" class="content-area">
			<div style="margin: 20px; text-align:center; font-weight:bold; font-size: 200%;">
				<?php
				if (test()) {
					$_SESSION['identifier'] = md5(microtime()); // set an identifier

					if (!empty($_SESSION['identifier']))
						echo "<br />new identifier: ".$_SESSION['identifier'];

					echo "<br />reload page to see if SESSION changes";
				} else {
					session_unset(); // uncomment this line => it works ?! (reload twice)
					echo "<a href='?action=support'>CLICK ME TO BEGIN</a>";
				}

				?>
			<?php wp_footer(); ?>
			</div> <!-- .container -->
		</div> <!-- #main -->
	</body>
</html>

flavio on "Show custom output from a plugin"

$
0
0

I need to build a plugin and use it to manage some custom elements (music albums and songs) in the backend. I store data in a separate db table.

I want to list those albums and songs in the frontend of the site. How can I can tell WP to let my plugin render the output?

In other words, how can I show data that I have in the database, in a similar way to what Drupal/Joomla allow to do? E.g. call the plugin directly from the URL, manage the URL structure from within my plugin.. is it possible at all with WordPress?

edow on "Remove text field from comment form"

$
0
0

Hi,

I would like to remove the text field from the comment form. The idea is that users can vote if they like the post or not. The like/unlike option must be done with radio buttons in a custom field (that would be the next problem).

But first: How can I remove the text field? I don't want it hidden, but entirely removed. What is the best practice for this? I can't find a decent solution.

Hopefully anyone can help me with this.

Viewing all 8245 articles
Browse latest View live




Latest Images