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

archiloni on "need to change navigation codes"

$
0
0

I'm working on a navigation menu, where i want to change the "selected status" at the same time as i'm using a "skew" in the css, the problem is that the selected element also skews the text, but i can't seem to target the text alone.

here is the html and css:

HTML:
<div class="nav">

<ul>
<li><a href="index.php">Forside</a></li>
            <?php wp_list_pages('title_li='); ?>
        </ul>
    </div>

Css:
.nav ul li{
    list-style-type: none;
    display: inline-block;
     color: #999999;
    text-decoration: none;
       width: 100px;
   height: 18px;
   background: #333;
   /* Skew */
   -webkit-transform: skew(-28deg);
   -moz-transform: skew(-28deg);
   -o-transform: skew(-28deg);
   transform: skew(-28deg);

}

.nav ul li a {
	font: bold 10px/20px Arial, Helvetica;
	text-decoration: none;
    float: left;
    width: 86px;
    padding: 0px 7px ;
    color: #999999;
     text-align: center;
       -webkit-transform: skew(28deg);
   -moz-transform: skew(28deg);
   -o-transform: skew(28deg);
   transform: skew(28deg);

}

.nav .current-menu-item > a,
.nav .current-menu-ancestor > a,
.nav .current_page_item > a,
.nav .current_page_ancestor > a{
	font-weight: bold;
        text-decoration: underline;
             color: #ffffff;
    text-decoration: none;
       width: 86px;
   height: 20px;
   background: #999999;
   -webkit-transform: skew(0deg,);
   -moz-transform: skew(0deg);
   -o-transform: skew(0deg);
   transform: skew(0deg);
}

The last part of the css skews all the html because of the "a" but that also makes the text in the nav menu skew and i can't find anywhere how to target the text alone.

Anyone got a clue?


jwiere03 on "Parameter for shortcode plugin"

$
0
0

I'm learning how to make my own plugins and shortcodes and I thought I'd combine the two and try to make a plugin that adds a shortcode that generates some text.

I have added a parameter that allows the user to pick how many paragraphs they want the shortcode to generate. However currently the shortcode has to be written like this
[text size=4]
In the function I use this to extract the value from the shortcode

function text_function($atts) {
  extract(shortcode_atts(array(
      'size' => 1,
   ), $atts));

What I would like to do is be able to just write the shortcode like this
[text 3]
And not have to include the name of the parameter since I'm only using one anyway and it makes it easier for adding the shorcode if you don't need to add it.

How do I add this feature?
Thanks

rcorr on "Displaying a custom error message"

$
0
0

Hello,

I am following along a tutorial in Yannick Lefebvre Plugin Cookbook on saving user-submitted content. The form saves the data in the database correctly, however if a required field is missing, I received the following instead of the abort message I provided (see below):

Comment Error
Please enter all fields correctly to post a comment.

I believe this is the default message for the comment form. The code I have is

if ( wp_verify_nonce( $_POST['br_user_form'],'add_review_form' ) &&
!empty( $_POST['book_title'] ) &&
!empty( $_POST['book_author'] ) &&
!empty( $_POST['book_review_text'] ) &&
!empty( $_POST['book_review_book_type'] ) &&
!empty( $_POST['book_review_rating'] ) ) {
   // Insert data in database and other stuff
   exit;
} else {
  // Display message if any required fields are missing
  $abortmessage = 'Some fields were left empty. Please ';
  $abortmessage .= 'go back and complete the form.';
  wp_die($abortmessage);
  exit;
}

To confirm that the program reaches the error block, I placed a JavaScript alert just before the $abortmessage variable and it shows up. Therefore, I am reaching that block of code if a field is empty.

If anyone can shed some light why the custom error message does not show, I will be much appreciated.

Thanks in advance.

Mirek2 on "Custom post order"

$
0
0

Hi guys,
I'm working on this website where the homepage is composed of both events (managed using the Events Calendar plugin) and articles. Currently, both are sorted by creation date.

I'd like to have the events sorted by their start date, while I'd like to order the articles by their creation date (still with both on the same page). How do I accomplish this?

copperdesk on "Select Menu at the front end"

$
0
0

Hello,

I have 3 level of pages.

Parent Page
- child page
-- grandchild page

  • I want create a front end select menu where user can chose the "parent page".
  • A second select menu should appear showing "child pages" depending on the selected "parent page".
  • A third menu should appear showing "grandchild pages" depending on selected "child page".

Is this even possible? I'm clueless. I've tried http://codex.wordpress.org/Function_Reference/wp_dropdown_pages#Examples but it works only for the first page.

<form action="<?php bloginfo('url'); ?>" method="get">
   <?php wp_dropdown_pages(); ?>
   <input type="submit" name="submit" value="view" />
   </form>

I would really appreciate if anyone take few minutes and show me the right direction. I will very grateful.

Thank you in advance.

webstandardcss on "Why will mobile users be redirected to the splash when i'm trying to exclude the"

$
0
0

Why will mobile users be redirected to the splash when i'm trying to exclude them from viewing this page. I just want desktop users to use be redirected to this splash and not the mobile users.

/*-------------------------------------------------------------------------------------*/
    /* Splash Page Hooks and Filters
    /*-------------------------------------------------------------------------------------*/

    // Get the user agent strings.
    $ipod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
    $iphone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
    $ipad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
    $android = stripos($_SERVER['HTTP_USER_AGENT'],"android");
    $windowsphone = stripos($_SERVER['HTTP_USER_AGENT'],"IEMobile");
    if( ! function_exists( 'custom_splash' ) )  {
        function custom_splash( $username ) {
            $referrer = $_SERVER['HTTP_REFERER']; // where did the user come from?
    	// If not mobile user.
    	if ($ipod == false || $iphone == false || $ipad == false || $android == false || $windowsphone == false) {
    	        // if there's a valid referrer
    		if ( empty($referrer) && ( is_front_page() || is_home() ) ) {
    			wp_redirect( '/splash/' ); // Redirect to the splash page.
    		}
    	} else {
    	}

    	return $referrer;
        }
    }

    add_action( 'wp_footer', 'custom_splash' ); // hook splash page

Mart89 on "customising custom field format"

$
0
0

Hi basically i need to override the code below in funcitons php

/**
 * Display list of post custom fields.
 *
 * @internal This will probably change at some point...
 * @since 1.2.0
 * @uses apply_filters() Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters.
 */
function the_meta() {
	if ( $keys = get_post_custom_keys() ) {
		echo "<ul class='post-meta'>\n";
		foreach ( (array) $keys as $key ) {
			$keyt = trim($key);
			if ( is_protected_meta( $keyt, 'post' ) )
				continue;
			$values = array_map('trim', get_post_custom_values($key));
			$value = implode($values,', ');
			echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value);
		}
		echo "</ul>\n";
	}
}

i know it involves add_filter or something but when i do this:

add_filter('the_meta_key', 'modified_meta_matt', $priority = 1, $accepted_args = 1 ); 

function modified_meta_matt() {
	if ( $keys = get_post_custom_keys() ) {
		echo "<ul class='post-meta'>\n";
		foreach ( (array) $keys as $key ) {
			$keyt = trim($key);
			if ( is_protected_meta( $keyt, 'post' ) )
				continue;
			$values = array_map('trim', get_post_custom_values($key));
			$value = implode($values,', ');
			echo apply_filters('modified_meta_matt', "<li><span class='post-meta-key-3'>$key:</span> $value</li>\n", $key, $value);
		}
		echo "</ul>\n";
	}
}

?>

It does work, but it displays the custom fields repeated like 6 times!
thanks for your help!

fitter man on "Which Filter Do I Want? Single Post"

$
0
0

I am new at this, so bear with me.

I'm writing a plugin that adds some Javascript to the page. It's working, but right now it's doing it on posts, lists of posts, etc. I have used "the_content" filter to do this. But what I want is to have this only invoked when a single post is being displayed rather than have it happen even when lists of posts are being shown.

So, which filter do I want, or is there some other way to achieve this?


idomaron on "Counting custom post type in every categories"

$
0
0

Hello everyone
I am trying to display, in one page, the number of posts I have in each one of the categories (AKA 'count'), but I must differentiate them by post-types. Example:

Economy: 10 books, 7 movies, 12 events.
Health: 7 books, 8 movies, 2 events.

What would be the best way to do so?

Thank you

AkivaWP on "managing cookies for a specific page"

$
0
0

Hi
I'm trying to do something like this:
I want every first time visitor to my site to be redirected to a registration page(for a mailing list, not site registration) and after the registration to be redirected to a thankyou page where a cookie will be set to prevent this process to happen on the next visit to my site.

I created a function for creating a cookie if it doesn't exist in the functions.php file and I also call it there.

Here are the problems I still have:
1. I want the cookie to be set only in the thankyou page. I tried doing it with a condition in the function "is_page(3)" but the page id is not loaded yet when functions.php is loaded.

2. Maybe this is a beginners question: how do I redirect to another page from within the wordpress page?

*The redirection from the registarion to the thankyou page are done automatically by the mailing list registration butoon so I don't need to do anything there.

Thanks in advance
Akiva

lnikj on "Multiple image comparison tool"

$
0
0

Hi

Does anybody know of a plugin that can emulate this sort of functionality (image change on rollover for the comparison of multiple images):

http://regex.info/blog/lightroom-goodies/jpeg-quality

Ignore the bars on the left it is just the bottom rollovers I am interested in.

I have tried a few sliders for this but none has text navigation and mouseovers.

Thanks

Nik

thatsdjmk on "Share User Login with other Wordpress Websites"

$
0
0

Hello, first of all sorry for opening a new topic but even there are many topics on this, none solves this issue with 3.8.1.

So I got 2 wordpress sites in 1 database.
Main table prefix: wp_
Second one table prefix: alt_

What I want to do is login to the second one with the users credential of the main one. What I did is add this to the wp-config.php file of the second Wordpress site:

define('CUSTOM_USER_TABLE','wp_users');
define('CUSTOM_USER_META_TABLE', 'wp_usermeta');

Now the user gets logged in to the second one, but after logging-in, he goes to the page "wp-admin/profile.php" and getting the message "You do not have sufficient permissions to access this page.".

I read many topics on this but I still cannot fix it. Tried changing the _init function by manually adding the table prefix but still nothing even though I read that it used to work on older versions of Wordpress.

Any help would be really appreciated.Thanks!

StephanWizcorp on "User data encryption"

$
0
0

Hi there!

I'm using WordPress for a website project where there're some requirements about privacy respect. Thus, I would to encrypt my data user using a AES algorithm. As I'm developing a custom plugin, I have no problem to encrypt my user's sensitive data, because I provide the page that contains the registration for. But the problem is when it comes to display and modifiy these information in the core WordPress' backend. I couldn't find out where and how I could do that... I've looked for this information in the Internet for hours without being able to find it.
I've found this page https://code.google.com/p/wordpress-aes/ where a guy has developed a repo on Google Code, doing (almost) the stuff I want to do, and he tells that he sent a mail to people at WordPress for merging his code into WordPess' core. As that guy did not do a plugin or whatever, it lets me think that it's not possible to modify the reads and writes done from and to the database, from the backend...
Could some one help me about this issue?
Thanks in advance.

xiao_coffe on "Onclick>Visited>Image>Replace?"

$
0
0

I have searched in Google for an answer on how an image should be replaced when a user click on a image/link (and stay that way). Every user should click the link/image. So i think visited will be best!

I've tried onclick example but it just goes back to the first picture again after refresh.

Also tried a:visited on background-images and hide text link but image will not change.

(I know how to get for exempal links turns green but not switch image)

It is the only feature that I have left before my website is finished, so I must get it to work.

is there any jquery code that can solve this, or is it possible with HTML and CSS?

fiddy7 on "Jetpack - Add extra row below google"

$
0
0

I would like to add another row of content below the row of share buttons and google plus. Is this possible?

Share:
Google+
New Row

Thanks for any guidance on this.


larzo92 on "add a new wpdb class"

$
0
0

hi, I want to add a new class wpdb $wpdb1 = new wpdb(my_db_login, my_db_password, my_DB_NAME,my_DB_HOST); for my wordpress blog but I don't know how.
when I put it the following class in wp-config i got this error message
Fatal error: Class 'wpdb' not found in line 80

Christine357 on "Same Navigation Different Styles"

$
0
0

So I was wondering how I could paste another navigation menu in but have it a different style as my original. For example, the code of my current one is:

<nav id="site-navigation" class="main-navigation" role="navigation">
			<h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3>
			<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
			<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
		</nav><!-- #site-navigation -->

To change the style of it I've edited the CSS of the "site-navigation" ID and the "main-navigation" class.

However now I'd like to also place a menu at the bottom of my page but I don't want it to have the same styles. The problem is, if I change the ID or CLASS of the navigation, the menu for mobile no longer works.

I just need to know how to have the same menu styled two different ways and stay linked to the "menu" functionality.

mindgamez83 on "Sports Score Ticker"

$
0
0

Hey im running a gaming community, im looking to add a sports score ticker like espn has. Something that i can update manually. I ve searching everywhere. If this is unappropriate i apologize

budyee on "Categories Widget Hack"

$
0
0

Im trying to use the included categories widget to display a menu of categories for my woocommerce store. currently it works real well however, all sub cats are shown no matter what parent cat you are in. I would like to only see the sub cats for the current cat that you have clicked on while hiding the subs in different categories. is this possible?

Original code...

/**
 * Categories widget class
 *
 * @since 2.8.0
 */
class WP_Widget_Categories extends WP_Widget {

	function __construct() {
		$widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) );
		parent::__construct('categories', __('Categories'), $widget_ops);
	}

	function widget( $args, $instance ) {
		extract( $args );

		$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base);
		$c = ! empty( $instance['count'] ) ? '1' : '0';
		$h = ! empty( $instance['hierarchical'] ) ? '1' : '0';
		$d = ! empty( $instance['dropdown'] ) ? '1' : '0';

		echo $before_widget;
		if ( $title )
			echo $before_title . $title . $after_title;

		$cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);

		if ( $d ) {
			$cat_args['show_option_none'] = __('Select Category');
			wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args));
?>

<script type='text/javascript'>
/* <![CDATA[ */
	var dropdown = document.getElementById("cat");
	function onCatChange() {
		if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
			location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
		}
	}
	dropdown.onchange = onCatChange;
/* ]]> */
</script>

<?php
		} else {
?>
		<ul>
<?php
		$cat_args['title_li'] = '';
		wp_list_categories(apply_filters('widget_categories_args', $cat_args));
?>
		</ul>
<?php
		}

		echo $after_widget;
	}

	function update( $new_instance, $old_instance ) {
		$instance = $old_instance;
		$instance['title'] = strip_tags($new_instance['title']);
		$instance['count'] = !empty($new_instance['count']) ? 1 : 0;
		$instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0;
		$instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0;

		return $instance;
	}

	function form( $instance ) {
		//Defaults
		$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
		$title = esc_attr( $instance['title'] );
		$count = isset($instance['count']) ? (bool) $instance['count'] :false;
		$hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;
		$dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;
?>
		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>

		<p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>"<?php checked( $dropdown ); ?> />
		<label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />

		<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> />
		<label for="<?php echo $this->get_field_id('count'); ?>"><?php _e( 'Show post counts' ); ?></label><br />

		<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />
		<label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
<?php
	}

}

jordanlwheeler on "Best way to post both to WordPress blog and vBulletin user blog?"

$
0
0

I have two domains hosted on the same server. One is a personal WordPress blog, the other is a travel community vBulletin forum. For reference, the WordPress blog is located here: http://jordanlwheeler.com/blog , and my vBulletin forum user blog is located here: http://forums.lifepackr.com/blog.php/5

I am a user on my vBulletin forum, and have my own blog on that system. I would like to duplicate any of my blog posts I make in my personal vBulletin user blog onto my personal WordPress blog. Or it could go the other way, duplicating any blog post I make in my personal WordPress blog onto the vBulletin user blog.

I have found a few plugins that do something similar, but most of them post to vBulletin forums, not to user blogs.

Any suggestions would be appreciated! Until then I'll be copy/pasting manually.

Viewing all 8245 articles
Browse latest View live




Latest Images