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

bickninder on "jQuery interfering with media library grid mode"

$
0
0

I have integrated some jQuery into my site to add a click to scroll effect and now my media library will not load in grid mode. here is the code

<script>
function donate() {
	$('html,body').animate({
        scrollTop: $(".support").offset().top - 113}, 1000);
}
function reachout() {
	$('html,body').animate({
        scrollTop: $(".reachout").offset().top - 113}, 1000);
}
</script>

When I remove this script the media library loads fine. What is causing this to happen? Do I have an error in my code?


MH13_at_16pur on "My three website redirecting to another site"

$
0
0

There are three website some files was deleted i have recovered but i am not getting how to stop redirection to another site. in url it is works but if i try on google search then it redirect to another site.
http://sra-esolution.com/

[moderated to fix link]

kushpaws on "Adding Color to Chat Room plugin?"

$
0
0

Hey guys,
Does anyone know how to add color to the text and/or background in a plugin? There's not much to the coding. There aren't any available adjustments, which is no good. I'm unable to find any other free chat room plugins that actually work. If i could at the very lest edit the content text to white rather than gray, that would be perfect. As of right now when people are speaking the text is blending with my gray background.

This is the entire CSS;

<body>
<span>
<style>
.chat-container {
height: 260px;
background-color: #ffff;
overflow: scroll;
overflow-x: hidden;
margin-bottom: 20px;
border-bottom: 1px solid #CCC;
}
</style>
</span>
</body>

oldcrusty on "Require selected dropdown list title-name as variable"

$
0
0

I'm new to WordPress but fairly ok with php. I want to select an item from a dropdown list of Titles and send it to another page for processing with if(isset($Post['title']) etc.
However when I select an item title from the dropdown and hit send, it takes me to the actual page of that title itself with links forward and back to all the other pages in the Title list.
I've tried a few things like attempting to make a string of the selected Title, and getting the list using get_post_meta(), but the end result is always the same as above.
If anyone can just point me in the right direction that would be fantastic.

[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

<form action="<?php bloginfo('url'); ?>/booking-times" method="post">
<div class="style">
		<select class="style" id="style" name="style">
		<option value="" selected="selected">Select preferred style</option>

		<?php
		$args = array(
			'post_type' => 'style',
			'meta_key' => 'style_type',
			'orderby' => 'menu_order',
			'order' => 'ASC',
			'post_status' => 'publish'
		);
		$style_listing= new WP_Query( $args ); ?>
<?php if ( $style_listing->have_posts() ) : ?>
			<?php while ( $style_listing->have_posts() ) : $style_listing->the_post(); ?>
				<option id="<?php the_id(); ?>" class="style"  value=" <?php the_title(); ?>"><?php the_title(); ?></option>
			<?php endwhile; ?>
		<?php endif; ?>

		</select>
		</div><!--end div class style-->
					</div><!--end div id style-->

							<div id="submit">
								<input class="data-submit" type="submit" name="submit" value="Next">
							</div><!--end submit-->
							</form>

hattiebernstein on "Logo customizer not working"

$
0
0

I am currently working on developing a child theme and have noticed that the logo uploader in the customizer is not working. Has anybody experienced this before or does anyone have any idea how I could fix it?

When I change from displaying dynamic text to displaying an image logo there is just a blank space. I can't figure out why this is..?

My site is not live so I can't include a link but any help would be greatly appreciated.

searay on "Sorting Posts by stars rating and custom meta box"

$
0
0

I want my visitors to have the ability to sort posts by stars rating and custom meta box(completed projects). I found both values in the database, but I don't know how use them. I studied WP codex and found this code, which I tought might be useful, but don't really know how to start.

<?php
/*
Template Name: Qbased
*/
?>

<?php get_header(); ?>

<div id="content" class="narrowcolumn">

<?php

 $querystr = "
    SELECT $wpdb->posts.*
    FROM $wpdb->posts, $wpdb->postmeta
    WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
    AND $wpdb->postmeta.meta_value = 'email'
    AND $wpdb->posts.post_status = 'publish'
    AND $wpdb->posts.post_type = 'agent'
    AND $wpdb->posts.post_date < NOW()
    ORDER BY $wpdb->posts.post_date DESC
 ";

 $pageposts = $wpdb->get_results($querystr, OBJECT);

?>
 <?php if ($pageposts): ?>
  <?php global $post; ?>
  <?php foreach ($pageposts as $post): ?>
    <?php setup_postdata($post); ?>

    <div class="post" id="post-<?php the_ID(); ?>">
      <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
      <?php the_title(); ?></a></h2>
      <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
      <div class="entry">
         <?php the_content('Read the rest of this entry »'); ?>
      </div>

      <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>
      <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>
  <?php endforeach; ?>

  <?php else : ?>
    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.</p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>
 <?php endif; ?>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

anown2 on "Add session to wp_get_referer()"

$
0
0

Good day,

I am having trouble adding a session to wp_get_referer().

Here is my current code:

<?php

// use the WordPress tag wp_get_referer to assign the referring URL to the variable $referer
$referer = wp_get_referer();
$_Session

// check if the URL is a specific one
if ( $referer == "http://site1.com" ) {

  echo '<span class="referrer-display"> <a href="itmsitedev.com/scol">RETURN TO YOGA FOR SCOLIOSIS</a> </span></p>';

} else {

  echo "";

}
?>

It is currently working but when the user transfer to another page or refresh the page the text disappear. I want it to store it in a session. Can someone point me to the right direction thanks a lot.

locker on "What is action to show plugin page"

$
0
0

When I develop a plugin, usually I need frontend page for him. I do the following:

add_action ( 'the_content', 'myCatchFunction');

function myCatchFunction($content) {
    $slug = 'myslug';
    if (get_post(get_the_ID())->post_name == $slug) {
        //do action
    }
}

and for the custom post types:

add_filter( 'template_include', 'myCatchFunction', 1 );

function myCatchFunction( $template_path ) {
    $slug = 'post_type_slug';
    if ( get_post_type() == $slug ) {
        //do action
    }
}

When I use first method, I need to create a page, and this is not good, because if I disactivate a module, I need to disactivate a page too.

Is this is the one solution or there is another method without page creating?


locker on "Add item to empty custom menu"

$
0
0

My module add items to custom menu dynamically. I faced with following problem - when I use add_filter

add_filter( 'wp_get_nav_menu_items', 'myFunction', 20, 2 );

this working only for non empty menus. If my menu is empty, this is not work. Of course I can add item to menu and this works, but maybe exist another sollution?

diondkb on "Shortcode not being evaluated when enclosed in audio component"

$
0
0

Hi,

When I used a shortcode I wrote to add a username as a variable to a url, it works and evaluates, except when used in the following instant:-

<audio controls="controls">
<source src="https://s3.amazonaws.com/sfs-premium/collection/canter/Asking+Your+Horse+to+Lengthen+the+Stride+in+Canter/585-Otherways-to-Measure-Stride-Lenght-and-Adjustment.mp3?name=[current_user]" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>

I copied and pasted this from the rendered page. Aname should appear where [current_user] is.

Am I missing something?

Cheers,
Dion

toluwanilydia on "Displaying Taxonomy terms with Shortcode in Custom Post"

$
0
0

I have a custom post 'downloads' with two taxonomy 'groups' and 'items'
I want the terms from 'groups' and 'items' to span out in post linking to their archive pages using shortcodes.

e.g

Groups: Electronic
Items: phone, Gaget

What i want is the same as the 'category' and 'tags' on archive3d.net

I've been able to get the following Codes

/*******display tag in post********/
function tags_in_post($atts) {    // [tags] outputs post's tags in a span
global $post;
$tags = '<span class="post-tags">';
ob_start();
the_tags( '<span class="post-tags">', ', ', '</span>' );
$tags = ob_get_contents();
ob_end_clean();
return $tags;
}
add_shortcode ('tags', 'tags_in_post');

This code works fine and spans out the terms but it only works with default post_tags

/**
 * Example: [wp custom_taxonomy="taxonomy_slug"]
 */

// First we create a function
function list_terms_custom_taxonomy( $atts ) {
// Inside the function we extract custom taxonomy parameter of our shortcode
    extract( shortcode_atts( array(
        'custom_taxonomy' => '',
    ), $atts ) );
// arguments for function wp_list_categories
$args = array(
taxonomy => $custom_taxonomy,
title_li => ''
);
// We wrap it in unordered list
echo '<ul>';
echo wp_list_categories($args);
echo '</ul>';
}
// Add a shortcode that executes our function
add_shortcode( 'ct_terms', 'list_terms_custom_taxonomy' );
//Allow Text widgets to execute shortcodes
add_filter('widget_text', 'do_shortcode');

// shortcode to use [ct_terms custom_taxonomy=customtaxonomyname]

Code Two is almost perfect my problems with this are;
1. the list jumps to the top of the page. I want the terms in front of each taxonomy (where the shortcode is pasted).

2. its a list, i want the terms spanned out in from of each other and separated by commas

I've tried many plugins, tried to mix these two codes but I've not been able to achieve much.

I'm very new to WordPress and Coding is quite new to me, I will be glad if somebody can spoon-feed me the code to achieve this. I've been stuck at this point for days.
Please Help!

marginaali on "Can users add things to posts/pages without going to edit mode?"

$
0
0

I am looking to create a website where user can add themselves as "present" in an event. This would be most practical (without my better knowledge) is a button which when an user presses, Wordpress adds the name of the user to a post/page, without user having to go to the editing mode and add it by hand.

Basically my question boils down to adding stuff to posts without going to editing mode.
Is this possible somehow with code or by a plugin?

Thanks for all the help.

george.firefalcon on "WordPress's Export Posts Function and Plugin"

$
0
0

Good Afternoon, people.

I'm starting a new WordPress site (using all knowledge I gathered with my first), although I can't export my older WordPress's site posts through the Import/Export Plugin.

The xml archive is downloaded, but it displays an error, as below:
Error on XML processing: Prefix not associated to a namespace
Position: file:///.../firefalcon039sworld.wordpress.2016-07-27.xml
Line number 127, column 2

And the beginning of the line and column is shown as below:
<itunes:summary>Show me Your World</itunes:summary>
--------^

I'm not experienced as PHP Developer and WordPress developer, so I ask for your help. Thanks!

MakarkinPRO on "Auth User Just by login"

$
0
0

Anybody may help me with the code. What I need:

1. User open domain.com/wp-login page
2. Type ONLY his LOGIN (NO password required)
3. He redirected to page, where system ask him type his OneTimePassowrd
3. System send OneTime generated password (it's not his real password) to his email
4. After hi typed CORRECT OneTimePassword from the email he receive AUTH COOKIE and loged in

So the process is simple, user just type his LOGIN and OneTimePassword (from email) and never type his real Password.

Thx.

hugobertrand on "Code for 1st word to be centred"

$
0
0

Hi! I can't find any info but anybody has the HTML code so that the 1st word of a phrase is centred but that the rest follows on the same lign without being centred?


adderlymontant on "How to remove main navigation menu from individual page template"

$
0
0

I am currently using the Zinc (laboratory) theme. and i can not find any option that would allow me to hide the Top header menu from individual pages.

zullimethod.com

This is my page, and i am trying to get ride of the menu from the pages that open in the light boxes from the Slider.

Any other pointers will be greatly appreciated.

Adderly,

fraggaria on "Remove COD Payment Instructions in order Emails"

$
0
0

Hello!

I hope that this one is the right sub-forum.

I want to hide the payment instructions in all customer order mails.
I managed to hide the payment instructions for BACS payment in the on-hold email with this code:

add_action( 'init', 'prefix_remove_bank_details', 100 );
function prefix_remove_bank_details() {

// Do nothing, if WC_Payment_Gateways does not exist
if ( ! class_exists( 'WC_Payment_Gateways' ) ) {
return;
}

// Get the gateways instance
$gateways = WC_Payment_Gateways::instance();

// Get all available gateways, [id] => Object
$available_gateways = $gateways->get_available_payment_gateways();

if ( isset( $available_gateways['bacs'] ) ) {
// If the gateway is available, remove the action hook
remove_action( 'woocommerce_email_before_order_table', array( $available_gateways['bacs'], 'email_instructions' ), 10, 3 );
}
}

So I thought I could copy the code and replace "bacs" with "cod" and the COD payment instructions are removed from the order emails, but no luck, they are still showing up.

To make it a bit more complicated: I don't want to remove the payment instructions on the thank you page.

Best regards
Mel

yoyos33 on "Find users by role"

$
0
0

Hello, I've got a little coding question.

I created a function on add form action to fill a list of users but I would like to filter only users with subscriber role. I could I add this filter ? Here's my initial code:

private function set_users() {
        $this->load_model('User');
        $users = $this->User->find(array('selects' => array('ID','display_name')));
        $this->set('users', $users);
    }

nwarmenh on "Auto-add post ID as a value in postmeta table"

$
0
0

I'd like to automatically add an entry to the postmeta table for each post where the key is "thepostID" and the value is the actual post ID number. And I'd like this to happen automatically for each post.

Why, you ask, would I want to do this when the Post ID is so easy to get in other places? It's a tale of two plugins.

I'm building a slider with one plugin to show the custom post types generated by a second plugin. The second plugin has a great shortcode for displaying its info that I can actually call in the slider authoring tool. But the shortcode requires a Post ID as one of its parameters.

The slider plugin, bless its feature-rich heart, allows access to all kinds of info about posts, like the_title and the_excerpt and anything in the postmeta table! But not the Post ID.

Plugin #1's support had the decent kludge idea of storing the Post ID in the postmeta table, which would make it accessible to me.

I know how to add custom fields manually in the admin interface, but I'd love for this to happen automatically behind the scenes. Unfortunately, my coding chops aren't up to the task.

Help and thanks?

wpgaijin on "Saving repeating fileds"

$
0
0

My plugins options page has repeating fields for one of the settings. I have the repeating part working but I cannot get the fields to save.

public function add_mimes_callback() {
  $option       = $this->ordered_uploads_options;
  $mimes        = $option[OU_PL_PREFIX . '_mimes'];
  $mime_folders = $this->mime_folders();
  ?>
  <script type="text/javascript">
    jQuery(document).ready(function($){
      $('#add-row').on('click', function() {
        var row = $('.empty-row.screen-reader-text').clone(true);
        row.removeClass('empty-row screen-reader-text');
        row.insertBefore('#repeatable-fieldset-one tbody>tr:last');
        jQuery('input, select', row).val('').attr('name', function(index, name) {
          return name.replace(/(\d+)/, function(fullMatch, n) {
            return Number(n) + 1;
          });
        });
        return false;
      });
      $('.remove-row').on('click', function() {
        $(this).parent().parent().remove();
        return false;
      });
    });
  </script>
  <table id="repeatable-fieldset-one" width="100%">
    <thead>
      <tr>
        <th>Extention</th>
        <th>Filetype</th>
        <th>Folder</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
    <?php
      $counter = 1;
      if( $mimes ) {
        foreach( $mimes as $mime ) {
          $counter++;
          $extention = $option[$mimes]['ou_mime_extention_' . $counter];
          $filetype  = $option[$mimes]['ou_mime_filetype_' . $counter];
          $folder    = $option[$mimes]['ou_mime_folder_' . $counter];
          ?>
          <tr>
            <td>
              <input type="text" name="ou_options_settings['ou_mimes']['ou_mime_extention_<?php echo $counter; ?>']" value="<?php echo $extention; ?>" class="all-options">
            </td>
            <td>
              <input type="text" name="ou_options_settings['ou_mimes']['ou_mime_filetype_<?php echo $counter; ?>']" class="all-options">
            </td>
            <td>
              <select name="ou_options_settings['ou_mimes']['ou_mime_folder_<?php echo $counter; ?>']">
                <?php foreach ( $mime_folders as $label => $value ) : ?>
                  <option value="<?php echo $value; ?>"<?php selected( $field['select'], $value ); ?>><?php echo $label; ?></option>
                <?php endforeach; ?>
              </select>
            </td>
            <td>
              <a class="button remove-row" href="#">Remove</a>
            </td>
          </tr>
          <?php
        }
      } else {
        ?>
        <tr>
          <td>
            <input type="text" name="ou_options_settings['ou_mimes']['ou_mime_extention_1']" class="all-options">
          </td>
          <td>
            <input type="text" name="ou_options_settings['ou_mimes']['ou_mime_filetype_1']" class="all-options">
          </td>
          <td>
            <select name="ou_options_settings['ou_mimes']['ou_mime_folder_1']">
              <?php foreach ( $mime_folders as $label => $value ) : ?>
                <option value="<?php echo $value; ?>"><?php echo $label; ?></option>
              <?php endforeach; ?>
            </select>
          </td>
          <td>
            <a class="button remove-row" href="#">Remove</a>
          </td>
        </tr>
        <?php
      }
      ?>
      <tr class="empty-row screen-reader-text">
        <td>
          <input type="text" name="ou_options_settings['ou_mimes']['ou_mime_extention_1']" class="all-options">
        </td>
        <td>
          <input type="text" name="ou_options_settings['ou_mimes']['ou_mime_filetype_1']" class="all-options">
        </td>
        <td>
          <select name="ou_options_settings['ou_mimes']['ou_mime_folder_1']">
            <?php foreach ( $mime_folders as $label => $value ) : ?>
              <option value="<?php echo $value; ?>"><?php echo $label; ?></option>
            <?php endforeach; ?>
          </select>
        </td>
        <td>
          <a class="button remove-row" href="#">Remove</a>
        </td>
      </tr>
      <?php
    ?>
    </tbody>
  </table>
  <p><a id="add-row" class="button" href="#">Add Mime</a></p>
  <?php
} // end mime_repeater

Here's a link to the full code Gist

I've been trying to get this to work for days. Unfortunately, I can't find very much on repeatable fields, so If any one can help me out I'd really appreciate it.

Viewing all 8245 articles
Browse latest View live




Latest Images