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

morningmist on "Warning: call_user_func_array() errors"

$
0
0

The website I am working on got completely deleted and then we uploaded a back up then we have had these function errors. Suggestion how to fix?

Here are the errors:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'do_css' not found or invalid function name in /home/fresheye/public_html/rentlucky.com/wp-includes/plugin.php on line 470

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'do_jslibs' not found or invalid function name in /home/fresheye/public_html/rentlucky.com/wp-includes/plugin.php on line 470

Here is the line it refers to:

* @return null Will return null if $tag does not exist in $wp_filter array

Here is the whole section:

/**
 * Execute functions hooked on a specific action hook, specifying arguments in an array.
 *
 * @see do_action() This function is identical, but the arguments passed to the
 * functions hooked to <tt>$tag</tt> are supplied using an array.
 *
 * @package WordPress
 * @subpackage Plugin
 * @since 2.1
 * @global array $wp_filter Stores all of the filters
 * @global array $wp_actions Increments the amount of times action was triggered.
 *
 * @param string $tag The name of the action to be executed.
 * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
 * @return null Will return null if $tag does not exist in $wp_filter array
 */
function do_action_ref_array($tag, $args) {
	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;

	if ( ! isset($wp_actions[$tag]) )
		$wp_actions[$tag] = 1;
	else
		++$wp_actions[$tag];

	// Do 'all' actions first
	if ( isset($wp_filter['all']) ) {
		$wp_current_filter[] = $tag;
		$all_args = func_get_args();
		_wp_call_all_hook($all_args);
	}

	if ( !isset($wp_filter[$tag]) ) {
		if ( isset($wp_filter['all']) )
			array_pop($wp_current_filter);
		return;
	}

	if ( !isset($wp_filter['all']) )
		$wp_current_filter[] = $tag;

	// Sort
	if ( !isset( $merged_filters[ $tag ] ) ) {
		ksort($wp_filter[$tag]);
		$merged_filters[ $tag ] = true;
	}

	reset( $wp_filter[ $tag ] );

	do {
		foreach( (array) current($wp_filter[$tag]) as $the_ )
			if ( !is_null($the_['function']) )
				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));

	} while ( next($wp_filter[$tag]) !== false );

	array_pop($wp_current_filter);
}

clementt on "Categories for Pages and permalink"

motionblue on "Need to associate categories to a page"

$
0
0

I have the following sitemap:

Home (Page)
About (Page)
- Who We Are (Page)
- What We Do (Page)
Media (Page)
- News (Category)
- Videos (Category)

I set up the menu in the above manner and its working fine.

However, facing problems with the Breadcrumbs (using Breadcrumb NavXT).

1. Whenever I go to Media > News, the breadcrumbs is showing Home > News (instead of Media > News), because they are unrelated.

2. I have a plugin that shows the subpages of the current page using a simple shortcode. For example, when I go to the About page, it'll show "Who We Are" and "What We Do" as its subpages in the form of a list. However, this is not working when I go to the "Media" page because everything under Media in the menu aren't really associated with the "Media" page.

I couldn't find any way of associating both the categories "News" and "Video" to the Page "Media". Is there any way I can do so so that the two problems I mentioned above can be resolved?

Fxam on "Custom Order Portfolio Filters Marble Theme"

$
0
0

Hi, I need help changing the order in which my portfolio categories appear on my site. http://newpage.felipeascacibar.com/

I have learnd that it is possible to:
'orderby' => 'slug',
changing the code in "portfolio.php"
but the theme I'm using doesn't have a
portfolio.php!?
I found some code in "theme_actions.php" but I cant figure out how to make it sort by slugs. Please Help!

/*
* Displays the isotope filters for the portfolio
*/
add_action( 'ebor_portfolio_filters', 'ebor_portfolio_filters_markup', 10 );
function ebor_portfolio_filters_markup(){
$output = '';
$output = '<ul class="filter">

  • ';

    $categories = get_categories('taxonomy=portfolio-category');
    foreach ($categories as $category){
    $output .= '

  • slug . '">' . $category->name . '
  • ';
    }

    $output .= '';
    echo $output;
    }
    /*

    ameraz on "How to include sticky posts in 'Blog pages show at most' X number of posts?"

    $
    0
    0

    I'm using the default Loop Code.

    I've set the 'Blog pages show at most' option in Settings > Reading to 11.

    In my home page -set to show Latest Posts- whenever I mark a post as 'Sticky' it's being added to the original 'Blog pages show at most' count, so the home page now shows 12 posts instead of 11.

    I want to avoid this!

    I want to keep 11 posts in total, that being -in the example above- 1 Sticky post plus 10 normal posts. Is this possible?

    I've already tested this with default themes and all plugins turned off.

    Any help will be very much appreciated.

    Erawkz1 on "Displaying RSS from specific bbpress topic, ect"

    $
    0
    0

    Hello there!
    Its been hours hours of research so thought Id ask for advice. What Im trying to do is to use some way, perderably throght a widgets, to display recent topics or threads on my right sidebar from bbpress/ Ive tried adding both atom and links to the native rss widg but keep getting error prompts,any suggestiond would be greatly apptrciatd/

    http://www.linkedf2f.com

    Diraen on "Add a new admin menu linked to a Private Custom Help System"

    $
    0
    0

    Hi !

    I've several authors on my blog and want to allow them to find all the writting instructions they need in the same private page.

    I don't want to use a plugin.
    I've all my private pages.
    I've added a custom menu, but it leads to a page where are the links to the private pages.

    First, I've created a menu that work but the html code is in the function.php file which is not clean enought for me.

    add_action('admin_menu', 'my_menu_pages');
    function my_menu_pages(){
    						// Add to admin_menu function
    add_menu_page(
    __('How to'), //The title used on the settings page.
    __('How to'), //The title used on the menu.
    'manage_options',  //Only displays the menu if the user matches this capability.
    'custom_admin_how_to',  // The unique name of the menu slug.
    themes.php?goto=build-styleguide-page
    'pg_building_function', //This is the callback function to run to display the page.
    '', //Display a icon just for the menu
    3); //This allows you to choose when the menu item appears in the list
    
    function pg_building_function(){
    if(!current_user_can('manage_options')){
    //wp_die( __( 'Vous n'avez pas les droits pour accèder à cette plop page.' ) );
    }//end if user is allowed.
    //add any form processing code here in PHP:
    ?>
    <div style="width:750px;">
    <h1><span style="position:relative;top:-7px">How to integrate images</span></h1>

    Second , I don't want to open the "How To" summary in the same page : Authors are supposed to click on this menu while they are writting their post. If the page open directly, they will lost they work. I need it to open to a new window or at least in a new tab.

    DoodleDogCody on "Conditionally adding shortcodes"

    $
    0
    0

    I use a plugin on a lot of my sites that modifies the normal [gallery] shortcode.

    On a current site, I would still like this to occur on every page on the site except for a specific post type.

    I was thinking that I could do something like this.

    if( !is_singular('custom-post-type') ) {
       add_shortcode('gallery', 'shortcode_function');
    }

    But this does not stop the new gallery shortcode function from firing. Is this possible to do at all? If so, can someone help point my in the right direction?


    miriamfalk on "ok to put this javascript into my index.php page?"

    $
    0
    0

    I am an affiliate marketer. My website is welldressedflapper.com. A company I want to work with has requested that I prove my ownership of the site by temporarily adding the following JavaScript to my index.php file:

    <script type="text/javascript" src="http://www.avantlink.com/affiliate_app_confirm.php?mode=js&authResponse=c0e403b9c022a0560d012207989d88d810197428"></script>

    I have located index.php in the editor but I'm new at this and very nervous. Is it ok if I insert this code into my index.php file? Is there a particular place where it should go?

    SaraGraybill on "Image slider only showing image title on first image"

    $
    0
    0

    I am working on a slider and I have added the image title to each image. The problem is only the first image in the slideshow is showing the title. None of the rest are. Here's the code:

    <?php
    	$check_imgs = get_post_meta( $post->ID, 'custom_otw-portfolio-repeatable-image', true);
    	    if( !empty( $check_imgs[0] ) ) {
    	 ?>
    	  <div class="portfolio-gallery-wrapper">
    	    <div class="flexslider" id="portfolio-gallery" style="margin-bottom:10px;">
    
    	    <div class="flex-viewport" style="overflow: hidden; position: relative;"><ul class="slides" style="width: 1600%; transition-duration: 0s; transform: translate3d(0px, 0px, 0px);">
    	        <?php
    	          $post_meta_data = get_post_custom($post->ID);
    	          $custom_repeatable = unserialize($post_meta_data['custom_otw-portfolio-repeatable-image'][0]);
    	           foreach ($custom_repeatable as $custom_image) {
    	                $url = wp_get_attachment_image_src($custom_image, 'otw-porfolio-large');
    	                $custom_image_title = get_post(get_post_thumbnail_id())->post_title;
    	                echo '<li data-thumb="'.$url[0].'" style="width: 700px; float: left; display: block;"><img alt="" src="'.$url[0].'"></li>';
    	                echo '<div class= "flexslider-title">';
    	                echo $custom_image_title;
    	                echo '</div>';
    	            }
    	        ?>
    	      </ul></div><ul class="flex-direction-nav"><li><a href="#" class="flex-prev flex-disabled"><?php _e( 'Previous', 'otw_pfl' ); ?></a></li><li><a href="#" class="flex-next"><?php _e( 'Next', 'otw_pfl' ); ?></a></li></ul></div>
    	      <?php
    
    	      ?>
    	    <div class="flexslider" id="portfolio-carousel" style="margin-bottom:10px;">
    	    <div class="flex-viewport" style="overflow: hidden; position: relative;"><ul class="slides" style="width: 1600%; transition-duration: 0s; transform: translate3d(0px, 0px, 0px);">
    	        <?php
    	          $post_meta_data = get_post_custom($post->ID);
    	          $custom_repeatable = unserialize($post_meta_data['custom_otw-portfolio-repeatable-image'][0]);
    	           foreach ($custom_repeatable as $custom_image) {
    	                $url = wp_get_attachment_image_src($custom_image, 'otw-porfolio-large');
    	                echo '<li data-thumb="'.$url[0].'" style="width: 210px; float: left; display: block;"><img alt="" src="'.$url[0].'"></li>';
    	           }
    	        ?>
    	      </ul></div><ul class="flex-direction-nav"><li><a href="#" class="flex-prev flex-disabled"><?php _e( 'Previous', 'otw_pfl' ); ?></a></li><li><a href="#" class="flex-next"><?php _e( 'Next', 'otw_pfl' ); ?></a></li></ul></div>
    	  </div>
    	<?php } ?>

    Any help is appreciated

    eruna_msl on "Publishing a post with Jquery"

    $
    0
    0

    I am writing a plugin where a click on the publish button is intercepted with jQuery in the admin. After clicking operations are performed using a timer to prevent timeouts. At the end of the operation it submits the form using jQuery('form#post').submit(); . This works, but it is saving as a draft not as published.

    Does anyone know how to submit the post form with jQuery and publish the page?

    The complete code is below:

    jQuery("#publish").click(function(event){
    
       		if( jQuery('#table_constructor').length==0) {
       			return true;
       		}
    
       		jQuery('#preview_window').fadeOut('fast');
    
    		  //add top
    		  jQuery('#table_constructor #post_content').val('<table>');
    
    		  //use timer to progressively transfer rows
    		  var c=0;
    		  var num=jQuery('#preview_window table tr').length;
    
    		  var addRowIntval = setInterval(function(){add_input_data()}, 2);
    		  jQuery('#loading_bar').remove();
    		  jQuery('#table_constructor').prepend('<div id="loading_bar"><h1>Saving Table</h1><div id="bar"><div id="meter" style="width:0"></div></div>');
    
    		  function add_input_data(){
    				//adjust progress bar
    				var per=c/num*100;
    				jQuery('#meter').width(per+'%'); 
    
    				//append table
    				var v=jQuery('#table_constructor #post_content').val();
    				var tr=jQuery('#preview_window table tr:eq('+c+')').clone().wrap('<p>').parent().html();
    
    				jQuery('#table_constructor #post_content').val(v+tr);
    				c++;
    
    				//finish
    				if(c>num){
    					clearInterval(addRowIntval);
    					jQuery('#table_constructor #post_content').val(v+TableLegs);
    				//	jQuery('#loading_bar').remove();
    					addAlternating_color();
    					jQuery('form#post').submit();
    				}
    			}		
    
    		  event.stopImmediatePropagation();
    		  return false;
    
    	  });

    Thank you
    E

    LysaGreer on "Odd Draft Posts Appearing"

    $
    0
    0

    Yesterday, I logged into my site, and noticed that there were 8 draft posts, all with the same category chosen, in my posts dashboard.

    I checked with my VA to see if she had logged in and done this, but, she hadn't - and so, I deleted them.

    Today, one reappeared.

    Same category chosen, no title, but, a draft that appeared as started.

    Has anyone encountered this? It's quite frightening, since, I have no idea how this is happening or how to stop it.

    Also, right now, it's just a draft post - but, what if there is more to come to destroy my site?

    jesseslam on "Using conditional tags in a child theme functions.php file"

    $
    0
    0

    Hi,

    My client's website is using Jigoshop and I need to add some conditional code to the functions.php file to show a link to a size chart only in certain category IDs just above the add to cart button. I've copied the code needed into my child theme's functions.php file as seen below but for some reason the div just won't show for these categories. I've tested the same code using the is_single tag and it works fine but just can't get it working with category IDs, any help would be appreciated please?

    <?php if ( in_category( array( 50,19,18 ) ) ) {
    echo '<div class="size-chart">Hello</div>';
    } ?>

    Many thanks,

    Jim Isles

    prahladyeri on "Unable to override pluggable function wp_mail"

    $
    0
    0

    A couple of days ago, my wordpress blog hosted on openshift suddenly stopped sending me mails and notifications. Until now I'd never bothered how wordpress handled mail sending since they always worked. Now, after going through codex, etc I came to know that wordpress handles this by calling the wp_mail(), then @mail() php function which ultimately calls the unix sendmail. Since I don't want to depend on sendmail/openshift, I decided to override the wp_mail pluggable function in my custom plugin, so that it calls my own sendgrid function instead of using the core one. Here is my code for plugin:

    <?php
    /**
     * Plugin Name: Sendgrid Plugin
     * Plugin URI:  http://www.prahladyeri.com
     * Description: Mail sending using Sendgrid Web API
     * Version:     0.1
     * Author:      Prahlad Yeri
     * Author URI:  http://www.prahladyeri.com
     * Text Domain:
     * Domain Path:
     * Network:
     * License:     GPLv2
     */
    
    namespace MailDemo;
    require_once('sendgrid.php');
    
    add_action( 'init', __NAMESPACE__ . '\plugin_init' );
    
    /**
     * Plugin Name: Prahlad's mail
     * Description: Alternative way to send a mail
     */
    if (!function_exists('wp_mail'))
    {
        file("http://".$_SERVER['SERVER_NAME']."/logme.php?" . 'Iwill_Override');
        function wp_mail($to, $subject, $message, $headers = '', $attachments = array())
        {
            sendgridmail($to, $subject, $message, $headers);
        }
        file("http://".$_SERVER['SERVER_NAME']."/logme.php?" . 'Iwas_Overridden');
    }
    else
    {
        file("http://".$_SERVER['SERVER_NAME']."/logme.php?" . 'Iwas_Not_Overridden');
    }
    
    function plugin_init()
    {
        file("http://".$_SERVER['SERVER_NAME']."/logme.php?" . 'Maildemo_Plugin_Init');
    }

    And here is the include file sendgrid.php (I tested it individually on CLI and it works fine):

    <?php
    function sendgridmail($to, $subject, $message, $headers)
    {
    $url = 'https://api.sendgrid.com/';
    $user='myapikey';
    $pass='myapipassword';
    
    $params = array(
        'api_user'  => $user,
        'api_key'   => $pass,
        'to'        => $to,
        'subject'   => $subject,
        'html'      => '',
        'text'      => $message,
        'from'      => 'myself@yahoo.com',
      );
    
        $request =  $url.'api/mail.send.json';
    
        // Generate curl request
        $session = curl_init($request);
        // Tell curl to use HTTP POST
        curl_setopt ($session, CURLOPT_POST, true);
        // Tell curl that this is the body of the POST
        curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
        // Tell curl not to return headers, but do return the response
        curl_setopt($session, CURLOPT_HEADER, false);
        curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    
        // obtain response
        $response = curl_exec($session);
        curl_close($session);
    }
    
    //only for testing:
    /*$to      = 'myself@yahoo.com';
    $subject = 'Testemail';
    $message = 'It works!!';
    echo 'To is: ' + $to;
    //wp_mail( $to, $subject, $message, array() );
    sendgridmail($to, $subject, $message, $headers);
    print_r('Just sent!');*/

    Trouble is this doesn't seem to be getting called by wordpress. It did work once or twice when I initially tested it yesterday, but after that its no longer working. Looks like wordpress is still calling the core wp_mail function instead of calling this one. Any idea folks ?

    Josiah Sprague on "Using Data from a Google Spreadsheet"

    $
    0
    0

    I've Googled for this, and I can't find exactly what I'm looking for.

    I have a Google Spreadsheet that contains data that needs to be automatically published on a client's Wordpress site.

    Previously, I published a link to the HTML version of the table. However, the client decided that an HTML table isn't "user friendly", so they want me to create a template that displays the data in an HTML/JS accordion layout.

    Doing this manually, would be fairly straightforward, but create an unacceptable labor bottleneck since the client updates their Google Spreadsheet on a daily basis and expects the published information on the website to be continually up to date.

    I'm aware that Google has a Data API, so I should be able to write some code that gets the data I need out of the Spreadsheet automatically and displays in a template on my Wordpress site.

    What I don't know is the specifics of how to make this work. Are there any plugins for pulling data from a Google Spreadsheet and being able to output it in a free format, or is this going to be all custom coding using PHP and the Google Data API? If it has to be completely custom, are there any tutorials that could help me figure out exactly how to do it?

    Essentially, if I could figure out how to pull the text from one particular cell and print it out on the html page via Wordpress, the rest would just be a matter of rinse and repeat until I get the page that I need built.


    thatposhgirl on "Adding a stylesheet link to a submenu?"

    $
    0
    0

    Is it possible to link a stylesheet in a submenu? I've tried wp_resgister_style() and wp_enqueue_style(), but it doesn't seem to be working.

    eta. I mean an admin submenu, if that wasn't clear.

    Nipon on "Adding placeholders in comments form"

    $
    0
    0

    I added placeholders to the comment form using the following code in comments. php and it works just fine.

    <?php
    	$comments_args = array(
            // change the title of send button
            // 'label_submit'=>'Send',
            // change the title of the reply section
            // 'title_reply'=>'Write a Reply or Comment',
            // remove "Text or HTML to be displayed after the set of comment fields"
            'comment_notes_after' => '<p><small>Your comment may be subject to editorial review.</small></p>',
            // redefine your own textarea (the comment body)
            'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><br /><textarea id="comment" name="comment" aria-required="true" placeholder="Type your comment here..." rows="8" cols="37" wrap="hard"></textarea></p>',
    		'fields' => apply_filters( 'comment_form_default_fields', array(
    
        'author' =>
          '<p class="comment-form-author">' .
          '<input id="author" placeholder="Your name..." name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .
          '" size="30"' . $aria_req . ' />' . ( $req ? '<span style="color:red" class="required">*</span>' : '' ) . '</p>',
    
        'email' =>
          '<p class="comment-form-email">' .
          '<input id="email" placeholder="Your email..." name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .
          '" size="30"' . $aria_req . ' />' . ( $req ? '<span style="color:red" class="required">*</span>' : '' ) . '</p>',
    
        'url' =>
          '<p class="comment-form-url">' .
          '<input id="url" placeholder="Your website..." name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) .
          '" size="30" /></p>'
        )
      ),
    );
    	comment_form($comments_args); ?>

    However, according to the Codex, I must set the variables (present in the above code) within my callback using the following code - which I did not do.

    $commenter = wp_get_current_commenter();
    $req = get_option( 'require_name_email' );
    $aria_req = ( $req ? " aria-required='true'" : '' );

    Where do I exactly place the above code? The output, by the way, is just fine i.e. I can see the placeholders in the comment form alright.

    btb84 on "editor wysiwyg disappears for non admin users"

    $
    0
    0

    hi guys, hope here's the right section for that.

    I have the known issue of the disappearing buttons on the wysiwyg editor. I've already tried editing the config.php, changing the php memory allowed and lots of "common" fix to that without results.

    So, I noticed that my editor disappears only for non admin members, and I found that, for some reasons, you can get your full working editor for writing new posts only if you have the manage_options permission.

    Of course I cannot give that permission to every member so I think there are 2 ways:

    - Give the permission to "junior" members and then hide via js/css the menu->general settings bar (very bad way...)
    - hack the theme php for bypassing that permission while loading the wysiwyg editor

    really don't know if those are possible ways... so any help is appreciated, thanks!

    alm36 on "Enlarging Logo Size in Header"

    $
    0
    0

    In the openstrap theme on my website, there is an option to add your own logo to the site. I did so, but it is much too small. When I try enlarging the logo in the code, it makes the whole page too wide with a big empty section on the side.

    Here is the only logo-related code I can find (in the CSS):

    .logo-row{
    #margin-bottom:10px;
    #max-height:173px;
    height:130px;
    max-height:130px;
    padding-top:5px;
    
    }

    I tried just adding "width:1600px" which made the logo itself large enough but the page too large as well.

    Please please help me out, thank you!!!

    Pete on "How to automatically assign a specific author to a custom post type"

    $
    0
    0

    How would I automatically assign a specific author to all custom posts assigned to a specific custom post type?

    Any help appreciated :)

    Pete

    Viewing all 8245 articles
    Browse latest View live




    Latest Images