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

MimmiN on "Html editor in form in plugin"

$
0
0

I'm building a local plugin to edit my custom tables, using forms. I would like to be able to use the WP html editor when editing text areas of the form. That is, I want the admin of the site to use the WYSIWYG editor in order to create links etc, and that the text being put into my table is html-code.

How may I achieve this?

I saw this post:
http://wordpress.org/support/topic/convert-text-area-into-wp-editor

So I'm able to put the editor there, but how do I define what row of the table to update with this instead of a normal text area?

In my mysql_query I define:
$beskrivelse = $row['beskrivelse'];
In my form I have:
<p><label>Beskrivelse av kurset </label><textarea name="beskrivelse" cols="90" rows="4"><?php echo $beskrivelse?></textarea></p>


Creatrix on "Show post title and content"

$
0
0

Hi,

I'm using this bit of code to try and pull through a post with its title and content.

SELECT post_title post_content FROM $wpdb->posts WHERE post_type='%s' AND post_status='publish' ORDER BY ID ASC

The problem is that it is only pulling through the post title and not the content. If I delete 'post_title' or 'post_content' then the other will show, but i can't get them to work together.

I've tried using 'AND' and a comma between them but then it breaks.

Anyone help?

selnomeria on "how to force CUSTOM POST TYPES to use default permalink"

$
0
0

my custom post type sample link is :
mysite.com/custom-type-name/post_slug

i want that my custom post types used the DEFAULT permalink structure, which i have set in Options>Permalinks (/%category%/$postname%), as all the normal 'post's use.

how to do that? have i to modify the core, to disallow it to create different permalink structure for custom post types? or have i to set register_post_type attributes( EP_PERMALINK, rewrite or etc.. i have no idea about them) ?...

dossrealestate88 on "Login Issues/Registration Hacks"

$
0
0

I've been using wordpress for about a year and I recently updated to the 3.7.1 version. Recently, someone hacked into my account and changed one of my plugins. The plugin that is now active allows people to register on my website (http://dossrealestategroup.com). I keep getting tons of registration notifications via email. I want to login to my website and delete the plugin and adjust my administration setting but every time I log in, it says that cookies are not enabled when they actually are (I'm using firefox). Sometimes when I log in, all I get is a blank white screen. I have no idea what to do. Any assistance that I can get will be greatly appreciated.

troyward on "Getting Term IDs in WP_Query"

$
0
0

I am trying to run a query to display posts from a custom post type that do not have any terms from a custom taxonomy associated with them. Here is the code.

$args = array(
'fields' => 'ids',
'orderby'=> 'id',
'order' => 'ASC',
'hideempty' => 0
);
$term_ids = get_terms( 'people', $args);

$args = array(
	'post_type' => 'organizations',
	'tax_query' => array(
		array(
		'taxonomy' => 'people',
		'terms' => $term_ids,
		'operator' => 'NOT IN'
		))
);

In the result I get entries from the first term id. So it seems like $term_ids is an array so it is probably getting only the first term id? But if it is getting the first term ID then it should not display posts from it. Instead it should display posts from other terms.

Please point out what I am doing wrong?

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!!!!!

jskates on "Changing a navigation label to user's first name?"

$
0
0

Hi Everyone,

I'm assuming this is relatively easy for all of you... I'm still a little newbish... What I'm trying to do is I have a dynamic profile page for users to manage their profile information on the front end of the website. The way I want to identify it in navigation is by having the navigation label represent the logged in user's first name. I've searched all around and surprised I didn't find anyone else had done this.

Thanks in advance!

andydraysen on "how to query mysql for newest posts"

$
0
0

What columns in wp_posts do I use to determine what a new post is?

I need to get title of the newest post.


chrisvallleyoc on "Removing Posts from the_loop?"

$
0
0

I have a unique circumstance where I'm trying to hide specific custom posts from one of the loops in my template. It was fairly easy to hide them with an if statement in the loop to prevent them from being shown, but the pagination still counts them, so I have erroneous blank pages.

Currently I'm using:

if (have_posts()) : while (have_posts()) : the_post();
	if (($post->post_parent) ) {
		continue;
	} else {
		[Code to display posts]
	}

Christiaan Conover on "Can't update settings with multiple settings sections"

$
0
0

I've got my plugin options set up to be in multiple sections, for ease of use and more efficient database calls. However, since reorganizing my Options page I can only seem so save changes made in the last section. No changes I make to earlier sections take effect.

The code for the admin options page is here: https://github.com/cconover/wp-author-customization/blob/master/author-customization/admin/author-customization-admin.php

Here's a screenshot of the Options page: https://github.com/cconover/wp-author-customization/blob/master/author-customization/assets/screenshot-2.png

I'm sure the answer is staring me in the face, but I need some help looking in the right place.

Jeroen on "Homepage doesn’t show a sticky post"

$
0
0

Hi,

I'm working with this piece of code to show the latest 4 posts of category-id 1 on my homepage.

<!-- Recent Blog Posts -->
<?php
//get post type ==> regular posts
        global $post;
        $args = array(
        'post_type' =>'post',
        'numberposts' => '4',
	'category' => '1'
        );
        $blog_posts = get_posts($args);
    ?>
    <?php if($blog_posts) { ?>
<section id="home-posts" class="clearfix">
            <h2 class="heading"><span>Laatste nieuws</h2>
            <?php
            $count=0;
            foreach($blog_posts as $post) : setup_postdata($post);
            $count++;
            //get fotoalbum thumbnail
            $feat_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'grid-thumb');
            ?>
<article class="home-entry <?php if($count == '4') { echo 'remove-margin'; } if($count == '3') { echo ' responsive-clear'; } ?>">

<div class="home-entry-description">
                    <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo the_title(); ?></a></h3>
		<?php if ($feat_img) {  ?>
	                <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $feat_img[0]; ?>" height="<?php echo $feat_img[2]; ?>" width="<?php echo $feat_img[1]; ?>" alt="<?php echo the_title(); ?>" /></a>
	                <?php } ?>  <?php echo excerpt('35'); ?>
                </div>
<!-- /home-entry-description -->
</article>
<!-- /home-entry-->
<?php
            if($count == '4') { echo '<div class="clear"></div>'; $count=0; }
            endforeach; ?>
</section>
<!-- /home-posts -->
<?php } ?>

Now i would like to make use of Sticky post, and have the sticky post shown at the far left of the latest post. I think i have tried all the options and suggestions published here: http://codex.wordpress.org/Sticky_Posts. But i guess I'm doing something wrong.

Could anyone help me with this?

jwashburn on "Having trouble with adding content to top of post using add_filter"

$
0
0

I have a plugin that I am working on hacking a bit. Currently it pulls some data and adds content to the bottom of a post using
add_filter('the_content', 'showWhiteboard');

It also uses add_filter( 'page_template', 'wodtogether_page_template' );

to grab the page template

It works fine, no problems with it. I am trying to get it post the data at the TOP of the post, right now its appending to the post. I have been reading the documentation http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content

and trying to understand priority but I dont think I have a handle on it yet. I tried editing the line from

add_filter('the_content', 'showWhiteboard');

to

add_filter('the_content', 'showWhiteboard', '5'); to make it show up before the actual regular post content, but it doesn't really change anything

Can I get a shove in the right direction?

Thanks

Christiaan Conover on "Update TinyMCE instance with AJAX not working"

$
0
0

I'm trying to update a TinyMCE instance I created with wp_editor() in my plugin using the following JavaScript:

jQuery( document ).ready( function( $ ) { // Don't execute anything until the page is loaded
	$( "#cc_author_postauthor" ).live( "change", function() { // If the author dropdown value is changed, execute the script
		/* Data to pass to the server. Called below during $.post() */
		var data = {
			action : 'cc_author_change_postauthor',				// Action hook for the server-side callback
			nonce : authorchange.nonce,							// Nonce received from server to authenticate request
			authorID : $( "#cc_author_postauthor" ).val()		// author ID for retrieving profile data
		};

		/* Send request to the server and process response */
		$.post(
			authorchange.ajaxurl,								// URL to send the request to the server
			data,												// Data to send to the server, stored in var data
			function( jsonString ) {							// Script to execute upon successful response from server
				var authormeta = $.parseJSON( jsonString );		// Parse the JSON received from the server response

				console.log( "This is the JSON response from the server: " + jsonString );

				$( "#cc_author_meta\\[0\\]\\[display_name\\]" ).val( authormeta.display_name );	// Change the value of the author display name to the value received from the server

				/* Handle description update differently depending on whether 'wysiwyg' is enabled in plugin options */
				if ( authormeta.wysiwyg == 'yes' ) {
					tinyMCE.get( "cc_author_meta\\[0\\]\\[description\\]" ).setContent( authormeta.description );
					console.log( "WYSIWYG is enabled and update attempted" );
				}
				else {
					$( "#cc_author_meta\\[0\\]\\[description\\]" ).val( authormeta.description );	// Change the value of the author bio to the value received from the server
				}
			} // function( jsonString )
		); // $.post
	}); // $( "#cc_author_postauthor" ).change()
}); // jQuery ready check

The console reports that the variable I'm checking for does have a value of 'yes', so the code should execute. However, the console also reports the following error:

Uncaught TypeError: Cannot call method 'setContent' of undefined

Does WordPress not use the object tinyMCE when an instance is created by wp_editor()? Is my syntax wrong?

jwashburn on "Need help with adding an option to a plugin"

$
0
0

I am working on reverse engineering a Plugin to modify it just a bit. Here is the plugin http://wordpress.org/plugins/wodtogether-whiteboards/ Currently it appends some data at the bottom of every post using
return $input . $whiteboardsHtml;

I can change it to post at the beginning of the post just by flipping it around to

return $whiteboardsHtml . $input;

Thanks to @bcworkz. He showed me that on this thread

http://wordpress.org/support/topic/having-trouble-with-adding-content-to-top-of-post-using-add_filter?replies=3

I would like to add an option to the admin section of the Plugin. Just a simple checkbox that says something like would you like this at the top of your posts? If the box is checked then it puts it at the top.

I was able to copy the add_settings_field section from one of the other option to create the checkbox. I was also able to copy the function the same way

add_settings_field('wodtogether_wod_location', 'Show WOD Above Post', 'wodtogether_setting_wod_location', 'wodtogether', 'wodtogether_main');

function wodtogether_setting_wod_location() {
	$options = get_option('wodtogether_options');

	$checked = (isset($options['wod_location']) && $options['wod_location']) ? ' checked' : '';
	echo "<input id='wodtogether_wod_location' name='wodtogether_options[wod_location]' {$checked} type='checkbox' value='1' />";

$wod_location = (isset($wodtogetherSettings['wod_location']) && $wodtogetherSettings['wod_location']) ? '/wod-location/1' : '';

Im stuck on how to create the if statement

mrapi on "Visits on the site counted twice"

$
0
0

Hi,I found on a tutorial a code for a plugin that counts visits on the site,I put it on the server and something strange:90% of visits are counted twice.
http://img585.imageshack.us/img585/3255/kgof.jpg

On localhost tests,is seems to work fine,that is the code:

<?php
/*
Plugin Name: Count visits
Author: User
Version: 1.0
 */

function bdetector_activate()
{
	global $wpdb;

	$table_name = $wpdb->prefix . 'bdetector';

	// will return NULL if there isn't one
	if ( $wpdb->get_var('SHOW TABLES LIKE ' . $table_name) != $table_name )
	{
		$sql = 'CREATE TABLE ' . $table_name . '(
				id INTEGER(10) UNSIGNED AUTO_INCREMENT,
				hit_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
				user_agent VARCHAR (255),
				PRIMARY KEY  (id) )';

		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
		dbDelta($sql);

		add_option('bdetector_database_version','1.0');
	}
}

register_activation_hook(__FILE__,'bdetector_activate');

function bdetector_insert_useragent()
{
	global $wpdb;

	$table_name = $wpdb->prefix . 'bdetector';

	$wpdb->insert($table_name,array('user_agent'=>$_SERVER['REMOTE_ADDR']),array('%s'));
}

add_action('wp_footer','bdetector_insert_useragent');

Thanks for any tip


osterichs on "Possible to show all metabox key from another plugin/theme ?"

$
0
0

is it possible to show all custom metabox key/name that plugin/theme developer make ?
i just wanna make a plugin that will support to detected custom metabox from all plugin/theme and show the metabox key to my dropdown menu, then i post the targeted metabox from my custom field plugin.

thanks.

ryan.kanner on "menu_order not working with slugs that start with admin.php"

$
0
0

I am filtering the menu_order hook (codex link) to change the order of my links in the admin menu. Currently the ordering will not work on slugs that begin with admin.php, so a settings page with the slug "admin.php?page=custom_settings_page" will just go to the bottom of the list. Anyone know of a workaround for this?

//change admin menu order
add_filter('custom_menu_order', 'my_custom_menu_order'); // Activate custom_menu_order
add_filter('menu_order', 'my_custom_menu_order');

function my_custom_menu_order($menu_ord){

if(!$menu_ord) return true;
return array(
    'index.php', //dashboard
    'separator1', //first separator
    'edit.php', //posts
    'edit.php?post_type=custom_post_type1', //custom post type 1
    'edit.php?post_type=custom_post_type2', //custom post type 2
    'edit.php?post_type=custom_post_type3', //custom post type 3
    'upload.php', //media
    'separator2', //second separator
    'admin.php?page=gf_edit_forms', //THIS GOES TO THE BOTTOM
    'edit.php?post_type=page', //pages
    'edit-comments.php', //comments
    'separator-last', //last separator
    'themes.php', //appearance
    'admin.php?page=custom_settings_page', //THIS GOES TO THE BOTTOM
    'plugins.php', //plugins
    'users.php', //users
    'tools.php', //tools
    'options-general.php' //WordPress options
);

}

mairouh on "Slider image to text field"

$
0
0

http://demo.siteorigin.com/pitch/

Is it possible to have text aswell? I want to make tab slider menu and this is the closest one I found.

although, if there was some kind of plugin which includes those things, it would be so much easier. Tabslider.com have exactly the one i've been looking for but it cost too much.

Adrian Toll on "Missed Schedule caused by HTTP authentication in htaccess"

$
0
0

I've been trying to track down the cause of this error and I've figured out what's been causing it in my instance - I have a staging server that's protected by an HTTP authentication username / password prompt which is set in the htaccess file. As soon as I removed that password request the post schedules started working perfectly.

I didn't see this mentioned anywhere else, so thought I'd post it here for others with the same issue, even if it sounds like there are a number of different causes.

jmedu on "Options Data Pull"

$
0
0

Hello Folks,

I am working on a plugin that changes the names of the 'options' table in the wpdb object so that data pushes and pulls are redirected to that table when certain functions are performed. My plugin changes $wpdb->options, and changes are pushed properly into the secondary table, but data is still being pulled from the default table.

Anybody have an idea as to why this is happening and how I can fix it so that data is both pushed and pulled from the secondary table?

James

Viewing all 8245 articles
Browse latest View live




Latest Images