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

tasko on "wp_editor Link Question"

$
0
0

Hello,
Is it possible to hide/remove the "Or link to existing content" section from tinyMCE (link button)?


ElPapay on "Report-a-post plugin?"

$
0
0

Is there a report-a-post plugin available? I tried searching but couldn't find any, maybe I got the keywords wrong. All I want is to place a "Report This Post" banner on my page (single.php) and if a my visitor will click on it, I will receive an email or notification at the back-end that a post has been reported, is there such a thing? Thanks in advance!

Jeff Edwards on "Newsflash feature"

$
0
0

Can anyone recommend a newsflash plugin that will briefly display a breaking news alert at the top or bottom of the screen only when a new headline in an RSS feed or tweet is detected?

I'm after something that is auto-hiding and only appears when a breaking news event occurs, like on the CNN and Sky News websites, rather than a static message-type notification bar that appears on every visit regardless and requires a click to close.

Any advice would be gratefully received. Many thanks.

d0cpaul on "Canvas Theme Custom Post Types"

$
0
0

So I've been searching and reading through the support forums for hours to resolve this so I thought I would finally ask. How do I customize a CTP template in the WooThemes Canvas theme? I created my own custom post type called, "disneyland". I duplicated content.php and archive.php and renamed it to content-disneyland.php and archive-disneyland.php and tried customizing content-disneyland but none of my changes reflect the CTP at all. What am I doing wrong?

Here is the code I used to register the CTP in functions.php:

// Register Custom Post Type

function custom_post_type() {

$labels = array(
'name' => _x( 'Disneyland', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Disneyland', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Disneyland', 'text_domain' ),
'parent_item_colon' => __( 'Parent Information:', 'text_domain' ),
'all_items' => __( 'All Disneyland Info', 'text_domain' ),
'view_item' => __( 'View Disneyland Info', 'text_domain' ),
'add_new_item' => __( 'Add New Info', 'text_domain' ),
'add_new' => __( 'Add New Info', 'text_domain' ),
'edit_item' => __( 'Edit Disneyland Info', 'text_domain' ),
'update_item' => __( 'Update information', 'text_domain' ),
'search_items' => __( 'Search products', 'text_domain' ),
'not_found' => __( 'No Disneyland Information Found', 'text_domain' ),
'not_found_in_trash' => __( 'No Disneyland Information found in Trash', 'text_domain' ),
);
$rewrite = array(
'slug' => 'disneyland',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'disneyland', 'text_domain' ),
'description' => __( 'Disneyland Key Information', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'revisions', 'custom-fields', 'post-formats', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => '/Disneyland-Custom-Post-Type-Menu-Icon.png',
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'page',
);
register_post_type( 'products', $args );

}

// Hook into the 'init' action
add_action( 'init', 'custom_post_type', 0 );

}

[Please always use the code buttons when posting code]

If you know of a good tutorial or know what the problem is please help!

ashishrevar on "Display blog post in HTML Page"

$
0
0

Hello there,

I've created HTML site in which I am having one blog tab. So what I want is that, if I click on that tab post within my wordpress blog must be fetched out and displayed as it do always. For this I am using code given at: http://digwp.com/2013/01/display-blog-posts-on-page-with-navigation/

But the problem is that, it simply fetches posts and if I click on post it is being redirected to original wordpress blog. I want post content to be displayed on the portfolio(my HTML site) only. I don't want to redesign my HTML theme for wordpress. Is there any hack for this?

dwawobieg on "shortcode and flot charts problem"

$
0
0

Hi.

I have big problem with flot charts resize plugin and shortcode in WP.

I try write plugin where I'll can do responsive charts via shortcode.
My plugin code:

define( 'ML_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );

require_once(ML_PLUGIN_PATH.'lib/chart.class.php');
//require_once(ML_PLUGIN_PATH.'lib/centyl.class.php');

add_action('init', 'ml_add_js_lib');

function ml_add_js_lib(){
	wp_enqueue_script( 'jquery');
	wp_enqueue_script('flot',plugin_dir_url(__FILE__).'js/flot/jquery.flot.js');
	wp_enqueue_script('flot.resize',plugin_dir_url(__FILE__).'js/flot/jquery.flot.resize.min.js');
	wp_enqueue_script('flot.comments',plugin_dir_url(__FILE__).'js/flot/jquery.flot.comments.js');
	wp_enqueue_style( 'ml-centyl-css',plugin_dir_url(__FILE__).'css/style.css');
	//echo '<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="excanvas.min.js"></script><![endif]-->';
}

function ml_flot(){
	$seria['nazwa']='lipa';
	$seria['data']='[[1,1],[2,2],[3,3]]';
	$seria2['nazwa']='lipa2';
	$seria2['data']='[[4,4],[22,2],[1,1]]';
	$seria2['settings']='points: { show: true }';
	$chart = new Chart();
	$chart->setWidth('50%');
	$chart->setHeight('40%');
	$chart->addSeries($seria);
        $chart->addSeries($seria2);
	$chart->setTitle('Wzrost');
	$chart->setOptions('{
					sidenote: {
						show: true
					},
					sidenotes: [
						{
							y: 2,
							contents: "Low Level",
							offsetX: 0,
							offsetY: 0,
							maxWidth: 0.5
						}]
					}');
	return $chart->renderChartShortcode('placeholder');
}

add_shortcode( 'dupa' , 'ml_flot' );

and my library class:

class Chart{

	protected $xaxes;

	protected $yaxes;

	protected $data;

	protected $width='100px';

	protected $height='100px';

	protected $options;

	protected $title;

	public function setTitle($title){
		$this->title=$title;
	}

	public function setOptions($options){
		$this->options.=$options;
	}

	public function setWidth($width){
		$this->width=$width;
	}

	public function setHeight($height){
		$this->height=$height;
	}

	public function addSeries($seria){
		$this->data[$seria['nazwa']]=array('data' => $seria['data'],'settings' => $seria['settings']);
	}

	public function removeSeries($nazwa){
		unset($this->$data[$nazwa]);
	}

	public function renderChartShortcode($placeholder){
		foreach($this->data as $key => $seria):
			$data.='{data:'.$seria['data'].', '.$seria['settings'].'},';
		endforeach;
		return '
		<div class="panel panel-primary">
			<div class="panel-heading">
				<h3 class="panel-title">'.$this->title.'</h3>
			</div>
			<div class="panel-body">
				<div id="'.$placeholder.'" style="width:'.$this->width.'; height:'.$this->height.'; border-style:solid; text-align: center; margin:0 auto;"></div>
                        </div>
                </div>
		<script>
			jQuery( document ).ready(function() {
				jQuery.plot(jQuery("#'.$placeholder.'"), ['.$data.'], '.$this->options.');
			});
		</script>';
	}

}

When I put width and height in px everything work well, but when I put value in % chart dosen't render.

P.S. I add css file with:

html{
        height: 100% !important;
    }
body {
        height: 100% !important;
    }

Any one have any idea what I do wrong?

zel on "Registration/lostpass errors showing on frontend"

$
0
0

Hello, I'm using s2member, customized my registration form and now I'd like to show all errors on my frontend maked registration page. Here's my code:

<?php $register = $_GET['register']; $reset = $_GET['reset']; if ($register == true) { ?>
        Message, when registered succesfully // it shows
        <?php } elseif ($reset == true) { ?>
        Message when lost password is ok // it shows
        <?php } else { } ?>

   // register form starts here
    <form method="post" action="<?php echo site_url('wp-login.php?action=register', 'login_post')?>

      //username
        <input type="text" aria-required="true" maxlength="100" autocomplete="off" name="user_login" id="user_login" class="user_login" value="<?php echo esc_attr(stripslashes($user_login)); ?>" tabindex="101">
      //Email
        <input type="text" aria-required="true" autocomplete="off" name="user_email" id="user_email" class="user_email" value="<?php echo esc_attr(stripslashes($user_email)); ?>" tabindex="102">

      //here wordpress takes the register_form customized in s2member
        <?php do_action('register_form'); ?><div id="reg-button">
        <input type="submit" name="user-submit" value="register" class="user-submit" tabindex="103" />
        <?php $register = $_GET['register']; if($register == true) { echo '<p>Check your email for the password!</p>'; } ?>
        <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?register=true" />
        <input type="hidden" name="user-cookie" value="1" />
    </form> 

        // now for the lost password
    <form method="post" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" class="wp-user-form">
        //You type the login/email here
            <input type="text" name="user_login" value="" size="20" id="user_login" tabindex="1001" />

        <?php do_action('login_form', 'resetpass'); ?>
        <input type="submit" name="user-submit" value="send pass" class="user-submit" tabindex="1002" />
        <?php $reset = $_GET['reset']; if($reset == true) { echo '<p>A message will be sent to your email address.</p>'; } ?>
        <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?reset=true" />
        <input type="hidden" name="user-cookie" value="1" />
    </form>

<?php } ?>

Basically, I'd like to show below errors on the front end, like I can show success messages now. What I'm lacking is;

  1. Username (required / already used)
  2. Email (is it valid, required, used)
  3. I have WP reCaptcha plugin, and if there is no captcha typed or it is wrong, it redirects me to the wp-login
  4. When recovering lost password, you can either type wrong username/password.

Any ideas how I can do it?
Thanks!

jokr on "Permalink for custom feed not found"

$
0
0

Hi all,

In a plugin I would like to add a custom feed. I have done this as follows:

add_action( 'init' , array($this, 'init_function'));
public function init_function() {
	add_feed( 'custom', array($this, 'get_custom_feed') );
}
public function get_custom_feed($comment) {
	echo 'custom feed'
}

Now the following url is working as expected:
http://www.example.com/?feed=custom

But with permalinks it is not working: http://www.example.com/feed/custom

It works for existing feeds.

get_feed_link( 'custom' ) returns the permalink and there wordpress returns Page not found.

Does anybody have an idea why?


robahas on "Programatically remove the WordPress News Widget from the dashboard"

$
0
0

Hi all - I'm customizing my dashboard and have used the codex instructions successfully. However, my WordPress News meta box stubbornly refuses to go away! It's ID is set to 'dashboard_primary' and according to the instructions I have this in my function:

unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_primary']);

But it's still there. Any idea why?

Thanks!

5ngua on "Should I change wp-content folder?"

$
0
0

Hello there,

I want to change wp-admin folder for my site, but I am not sure the plugins and themes will work or be broken.

I have several question:
- Should I change wp-content folder?
- Have you ever done this smoothly? Is there any known problem?

My site has about 50 posts and pages, 100 bbpress topics and I am Ok to change the image URL for each posts if needed.

Here is the list of my installed plugin:
Advanced Excerpt
Akismet
bbPress
BuddyPress
Jetpack by WordPress.com
Polldaddy Polls & Ratings
Revolution Slider
WooCommerce
WordPress SEO by Yoast
WPBakery Visual Composer
WP Super Cache

russgrue on "mywidgetclass::widget gets called in admin pages."

$
0
0

Hey, I'm not sure if this is the right place to ask this but I've discovered that when I browse around the admin pages my widget display function in mywidgetclass is getting called. I've noticed this because the when the function gets called a counter is incremented.

The widget is called in several sidebars in the theme and while browsing the admin pages each time the widget is supposed to display (on the site) it is also called in the admin page.

I've tried wrapping the widget display function in a:
if (is_admin()) {
}
but this doesn't appear to work.

Is there something I can test for or some other way to prevent my widgets getting called on admin pages?

Thanks
Russ

mbschori on "Remove Gallery Zoom Option"

$
0
0

I am creating a website for a wedding shop and am having an issue with the galleries. If you click on the image, it will bring you directly to that designer's website as opposed to enlarging the image like most galleries do.

I'd like to get rid of the gray box and zoom symbol that pop up when you hover over the images. How can I do this? Below is one of the galleries that I am talking about.

Thanks a million!!!!!

mariz_p on "pending topics must be viewable to the author only - bbpress moderation plugin"

$
0
0

Hi,

I hope someone here can help me clarify my codes.
You see I have modified the bbpress moderation plugin since I am not getting any response from it's author.

Okay, here's the problem. I am making the pending post view-able only to the author, admin and moderators. Right now the bbpress moderation pending posts "always display option" is view-able to all. I have added some codes to it to achieve my goal. And when I added the global $post and call the post_author, I can't make it work.

Below is my code:

function query($bbp) {

		global $current_user, $post;

		if (get_option(self::TD . 'always_display')) {
			$post_author = wp_get_current_user();

			if ( (current_user_can('moderate')) || (current_user_can('level_0') && $post_author->ID == $post->post_author) ) {

					add_filter('posts_where', array($this, 'posts_where'));

			} else{

			}
		}
			else
			{

				// remove_filter('posts_where', array($this, 'posts_where'));
			}

		return $bbp;
	}

I am hoping for your kind response. Thanks.

Best regards,
Mariz

lmstreng on "Custom Post Type, the single-.php problem"

$
0
0

So I feel like I am doing something obviously simple, yet can't figure out what!

I've created my custom post type 'project' and created single-project.php to display the individual project posts. It's working (sort of), my problem is that instead of displaying the content for just the 1 post, it shows the content for all of the posts i've created.

Here's my single-project.php file:
http://pastebin.com/z20gVtEL

Any help would be much appreciated!

Amal 007 on "My Addon sites hacked"

$
0
0

Hi,
My sites displayed a message while loading it as haked by some Hasturk or something...Now i am being displayed nothing jus
"Index of /

.ftpquota
Apache Server at ***.com Port 80"

when i checked in suscuri.net..it showd a warning
"Security warning in the URL:
http://&***.com/404testpage4525d2fdc
and Security warning in the URL:
http://***.com/404javascript.js "
When i checked the ftp all my files are being deleted except ftp quota file.
Can anyone please help me how should i proceed i am having only the wordpress export file(all).


lacheney on "Comma in foreach output"

$
0
0

Hi,

I'm trying to find posts of a certain type that share taxonomy terms with the current single post being displayed.

Here's my code:

$mentionslist = wp_get_post_terms($post->ID, 'employer-mention', array()); 

if ($mentionslist) {
$mentionsoutput = '';
  foreach($mentionslist as $mention) {
    $mentionsoutput = $mentionsoutput.','.$mention->term_id;
  }
}

echo $mentionsoutput;

The echo of $mentionsoutput returns: ,575,576,1636

What I would like to do is remove the comma which appears right at the beginning so that I can use the variable in a term ID array. Which part of my foreach is wrong?

Thanks,

Lewis

MagicTigger on "site list similar to wp_get_archives"

$
0
0

hi, i have an archive page that shall show the last 25 articles.
so far, so good - with "wp_get_archives".

BUT, there are static sites that i want to list in the same list.
on first sight i said heureka, there is "wp_get_sites", but this function returns not what i wanted.

[snip]

<h3>Die letzten 25 Beitr&auml;ge</h3>
            <ol>
                <?php wp_get_archives('type=postbypost&limit=25'); ?>
<?php wp_get_sites('public=1&limit=25'); ?>
            </ol>

[snap]

http://sterkrader-reiterhof.de/archiv/

i know there are some plugins doing nearly what i want, but its only nearly. :)

any ideas?

many thanks in advance.

dannybeton on "wp_trim_words formatting"

$
0
0

I'm using the wp_trim_words function to just take the snippet of a custom post's content:

echo '<p>' . wp_trim_words( get_the_content(), 50 ) . '</p>';

The content text is formatted as follows:

"One of our VIP members (well… Ned) has his 1984 black Porsche 924 for sale!

This car is in truly terrific order and is well known locally having been frequently shown at numerous classic car events. To see the advert on DoneDeal click here."

But when wp_trim_words() is used it's displayed as:

"One of our VIP members (well… Ned) has his 1984 black Porsche 924 for sale! This car is in truly terrific order and is well known locally having been frequently shown at numerous classic car events. To see the advert on DoneDeal click here."

The break return after "for sale!" is gone.. Is there any way to keep the formatting of the post when using wp_trim_words() ?

MeAgainAtPMP on "WordPress 3.8 and JS/HiddenLink.B"

$
0
0

I have a user claiming the AVG Internet Security program has found the virus named JS/HiddenLink.B on my WordPress site. I am using WordPress 3.8. The only posts I can find on this are three years old and I can not detect this virus with any of my tools. How can I check for this virus and how can I clean it up if I find it?

Thanks

hombero on "media_handle_sideload() not working, halts execution"

$
0
0

Hello,

I am attempting to write a PHP script which downloads an off-site image from url, saves it to a permanent directory, and then attach it to a post as a thumbnail. The script successfully saves the temp file, and then saves a permanent file in the wp-content/uploads/... directory, but the call to media_handle_sideload() halts execution.

This is what I have so far:

function wp_sideload_image($post_id, $file, $desc = null)
{
	if ( ! empty($file) ) {
		// Download file to temp location
		$tmp = download_url( $file );
		// Set variables for storage
		// fix file filename for query strings
		preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $file, $matches);
		$file_array['name'] = basename($matches[0]);
		$file_array['tmp_name'] = $tmp;

		// If error storing temporarily, unlink
		if ( is_wp_error( $tmp ) ) {
			@unlink($file_array['tmp_name']);
			$file_array['tmp_name'] ='';
		}

		// do the validation and storage stuff
		if ($debug) { echo 'File array: <br />';
			var_dump($file_array);
			echo 'Post id: <br />';
			echo $post_id;
			echo 'Desc: <br />';
			echo $desc;
		}
// Execution fails on next line
		$id = media_handle_sideload( $file_array, $post_id, $desc );

		// If error storing permanently, unlink
		if ( is_wp_error($id) ) {@unlink($file_array['tmp_name']);}
		add_post_meta($post_id, '_thumbnail_id', $id, true);
	}
}

The parameters being passed are:
$post_id -> an integer representing the post to which to attach
$file -> the url to the remote file
$desc (optional) -> the description of the attachment

I have confirmed that the variables are valid when entering the function, though the script halts when media_handle_sideload() is called.

Any insight and/or help with this issue will be extremely appreciated, thank you!

Viewing all 8245 articles
Browse latest View live




Latest Images