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

The Travel Thread on "Related posts without plugin in loop.php"

$
0
0

Hey all, I've been able to call related posts without a plugin, however I can't seem to get it in the right place.

when i add the code to single.php it shows up very bottom of the page, after the content, comments, etc. I want it after content but before comments.

adding code to loop.php works great on single post pages BUT it also shows up below each excerpt on the homepage which we don't want.

Am I doing something wrong? Any insight is greatly appreciated. Thanks in advance!


vahost on "Modify primary nav URLs on-the-fly by adding parameter"

$
0
0

I'm relatively new to creating filters, and consequently pretty weak in my understanding of how to create and use them. I'd appreciate a little guidance on how to create this one.

In this case, I want to filter the URLs of the primary navigation menu on-the-fly when the app detects certain circumstances.

My primary navigation items by default are not set with URLs that have a question mark and a myvar parameter at the end. They're just standard permalinks with the primary domain and slug.

But if the app detects a session variable that I've set elsewhere, I want to filter all the primary navigation items to add ?myvar=1 at the end.

Can someone help me accomplish this?

DominikGX on "Prevent Wordpress from generating default image sizes"

$
0
0

Hello,

I want to stop WordPress from creating images in lower image sizes. Allthough I tried to set all parameters in Admin panel -> Settings -> media to 0, my ftp server shows me, that wordpress generated the files.

How can I disable the automatic image resize function?

darksider59 on "Movie info in post"

$
0
0

Hello,

I've been looking for over 1 week now about how to add movie info in a post. I've seen a wordpress website doing it but some steps are still no clear.

I tried custom taxonomies for adding fields like actors, genres, ... and I think it is the right thing to use but I still have problems. I want to add some fields such as the realease date (just text). I did a schema about how I want to do it, I guess it will be easier to explain :

http://image.noelshack.com/fichiers/2014/46/1416099274-cat-2.jpg

(I did a research here before posting but I didn't find a related post)

vishnudath on "Set WordPress to Use Default images in all existing posts (not-resided-images)"

$
0
0

wordpress automatically resized every image and make images like this

mywebsite.com/wp-content/2014/03/original-image-name-300x280.jpg

and uses the same url to show image in WP Posts!

--

i already got hundreds of articles in my blog. so not possible edit them manually to remove -300x280 from the image url.

i tried to make to via SQL, but re-size dimensions varies every time... so not possible to use replace option.

--

is it possible to update all posts at ones, to make them to use, original image urls in articles ?

fw_w on "Can't receive $_POST or $_GET var in WP Plugin"

$
0
0

Hi

I'm trying write a wp plugin and want to post a form using HTTP POST. The problem is I can't receive $_POST when submit my form in plugin's class. It works outside my class only.

I hooked the function using this in my class constructor:
add_action('admin_post_add_foo', array($this, 'add_foo')

And in a function let's say I just want to dump $_POST var:

public function add_foo() {<br />
   var_dump($_POST);<br />
}

which doesn't work.

kosackenzipfel on "Plugin/Widget Coding - document.getElementById doesn´t work"

$
0
0

Hello!

I have a problem creating a plugin/widget for wordpress. In the part of the code where the backend-form is created "document.getElementById" doesn´t work. I can read the fields of the form but I cannot change their value using JavaScript (Code below):

echo "<script type='text/javascript'>";
echo "function feld_aendern()";
echo "{";
echo " var alterwert = document.getElementById('tt11').value;";
echo " alert(alterwert);";
echo " var aenderung = document.getElementById('tt11');";
echo " aenderung.value = 'Neuer Wert';";
echo " alert('...wieder nicht geklappt?');";
echo "}";
echo "</script>";
echo "<p><input type='text' id='tt11' value='Alter Wert' onchange='feld_aendern()' /></p>";

The fields are generated by the .php - so why can I only read them (the 'alert' works), but not change their values? Must be something stupid I don´t see...
I also tried it excluding the JavaScript - with the same result...

// hier endet PHP ?>
<script type="text/javascript">
    function feld_aendern() {
        var alterwert = document.getElementById('tt11').value;
        alert(alterwert);
        var aenderung = document.getElementById('tt11');
        aenderung.value = 'Neuer Wert';
        alert('check?');
    }
</script>
<p><input type="text" id="tt11" value="Alter Wert" onchange="feld_aendern()"></p>
<?php // hier gehts weiter mit PHP

I would be very glad if I anyone could help me!!!

Pete on "simple = - / x calculations with 2 custom fields"

$
0
0

simple = - / x calculations with 2 custom fields

Would anyone have a simple piece of code that calculates and displays a simple mathematical calculation (=-/x) between 2 custom fields?

Thanks heaps


nicearma on "Changing status code of wp_ajax_*"

$
0
0

I'm trying to change the status code of the result of call with ajax some function wp_ajax_* example wp_ajax_make_error, but i dont if is possible and if is possible how to do it.

duffmen on "Delete Post From front Page ( With Wp-admin restriction )"

$
0
0

Hi there.
Could someone help to solve problem:
I need that my authors to be able to delete their own posts from frontend.
I use the function to do this:

function wp_delete_post_link($link = 'Delete This', $before = '', $after = '') {
    global $post;
    if ( $post->post_type == 'page' ) {
    if ( !current_user_can( 'edit_page', $post->ID ) )
      return;
  } else {
    if ( !current_user_can( 'edit_post', $post->ID ) )
      return;
  }
    $message = "Are you sure you want to delete ".get_the_title($post->ID)." ?";
    $delLink = wp_nonce_url( get_bloginfo('url') . "/wp-admin/post.php?action=delete&post=" . $post->ID, 'delete-post_' . $post->ID);
    $htmllink = "<a href='" . $delLink . "' />".$link."";
    echo $before . $htmllink . $after;
}

But also I use "admin_bar_disabler" plugin which restricts all roles to access to the admin bar (except "Administartor").
So authors can't delete any own posts because they don't have access to /wp-admin link.
Administrator can delete any post from frontend using the function wp_delete_post_link.
Thanks for advance.

icetek on "html entity problems with xmlrpc python."

$
0
0

If I try to send HTML through post.content via python Wordpress xmlrpc it scrambles up and renders & html entity characters breaking HTML entirely. What could cause this and how do I fix it?

winkm89 on "tinyMCE 4: access to elements in an iframe opened with editor.windowManager.open"

$
0
0

Hi,

I'm currently trying to write a custom tinyMCE plugin for WordPress and I have a problem:

I open a new editor window (iframe) with the following code:

editor.windowManager.open( {
    url: 'http://127.0.0.1/wordpress/wp-content/plugins/teachpress/admin/document_manager.php?post_id=1003',
    title: 'teachPress Document Manager',
    id: 'tp_document_manager',
    inline: 1,
    width: 950,
    height: 560,
    buttons: [
    {
        text: 'Insert',
        onclick: function(){
            // How can I access to the values of the checkboxes in the iframe here?
        }
    },
    {
        text: 'Close',
        onclick: 'close'
    }
]
});

In the opened iframe I have some checkboxes:

[...]
<iframe src="http://127.0.0.1/wordpress/wp-content/plugins/teachpress/admin/document_manager.php?post_id=1003" tabindex="-1">
[...]
<form method="post">
<input type="checkbox" name="tp_file_checkbox[]" id="tp_file_checkbox_11" class="tp_file_checkbox" value="11">
<input type="checkbox" name="tp_file_checkbox[]" id="tp_file_checkbox_12" class="tp_file_checkbox" value="12">
[...]
</form>
</iframe>
[...]

And here I have no idea how I can read the values from the checkboxes within the function for the insert button.
I've tried it with:
jQuery(".tp_file_checkbox")
But jQuery does not find any element and unfortunately tinyMCE sets no name or id for the iframe (only for the parent DIV of the iframe).

Has anyone an idea how can I read the values from the checkboxes?

jmevz on "Display Responsive Ads on Shop Page"

$
0
0

Hello,

I'm running WP 4.0 with the Fruitful theme and Woo. I'm wanting to modify the Shop archive page so that a banner ad is displayed horizontally between every 5 rows of products (728*90 banner). The ad type will be responsive so we'll need to set the size for the desktop ad and if I'm right, it will do the sizing automatically for mobile.

I'm a beginner when it comes to modding core files. If you're willing, I'm forever grateful for your help.

Best Regards,
Jeff

Fred the man on "Generating qr code with google chart + download it from wordpress backend"

$
0
0

0 down vote favorite

i'm working on plugin for wordpress, which can automatically generate a qr code with google chart within each posts in the wordpress backend and download the qr code, because i need further functionality.

The issue is to get the link for the post as you see it on the frontend: eksample.com/animals-in-zoo/ instead of the link to the backend: eksample.com/wp-admin/post.php?post=100&action=edit for generating qr code with google chart.

I'm a totally beginner and i have searched through google to find information how to do this and i got so far. I created the setup and php file for the plugin and added a custom meta box for the post page, where the qr code should be generated and with a option to download it.

I need to know how to do following:

Generate qr code with google chart so it gets the fronend link and not the backend from wordpress

Option to download it afterwards

So far the plugin looks like this:

<?php

function qcqr_add_meta_box() {

add_meta_box(

'qcqr_download', // The id for the metabox
'Download QR Kode', // The titel for the metabox

'qcqr_display_quickcode_download_metabox', // The function for rendering the markup

'post', // Where it will be displayed
'side', // Positioning of the metabox in edit/new posts

'high' // Priority of where the metabox will be displayed

}

add_action( 'add_meta_boxes', 'qcqr_add_meta_box' );

function qcqr_display_quickcode_download_metabox() {

}

Hope you can help me out, it would be very kind of you.

Thank you very much

Best regards Fred the man

Stephen on "Timthumb to native Wordpress image resized thumbnail"

$
0
0

My old line I'm trying to replace is as follows.

<img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo $post_images[0];?>&w=105&h=70&zc=1&q=80<?php echo $thumb_url1;?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

I've tried using the_post_thumbnail but not sure how I should be using it. Also seen http://matthewruddy.github.io/Wordpress-Timthumb-alternative/ but not sure how to use it as it lacks documentation, so not sure the right way to implement it.

Any suggestions, would be gladly appreciated it. Thanks.


coderdj412 on "WP_Query empty when using tax_query"

$
0
0

I am attempting to query a couple taxonomies via a custom post type: venues.

Using the example, I came up with this query but, it comes up empty:

$args = array(
	'post_type' => 'venue',
	'tax_query' => array(
		array(
			'taxonomy' => 'venue_type',
			'field'    => 'slug',
			'terms'    => array('bar', 'club'),
		),
	),
);
$query = new WP_Query( $args );

But, if I use this, I get results:

$args = array(
	'venue_type'    => 'bar', // Will not accept arrays and I need multi
);
$query = new WP_Query( $args );

michelle.oswell on "Pulling out caption from post image"

$
0
0

I have an old plugin that I like (Drop Caps), and for the most part it works well (see my site. The biggest problem (and I've seen this with newer, similar plugins) is that on posts where the first element in the post is an image from the media library, the plugin puts a drop cap on the caption tag rather than the first paragraph of text in the post.

I can see why this is happening - there's a regex that looks for the first <p> tag and then drop caps the first capital letter after that tag.

What I'd like to do is set up a condition in the plugin's function that looks for the caption and if the <p> is a caption, it's not included, but I don't know how to call image caption to do that.

Here is the existing code for the "not included" elements from the plugin:

function is_excluded($options){
			global $post;
			$excluded_cats=$options['excluded_cats'];
			$excluded_ids=$options['excluded_ids'];
			$id=$post->ID;
			$title=$post->post_title;
			$name=$post->post_name;
			if(in_array($id,$excluded_ids)) return true;
			if(in_array($title,$excluded_ids)) return true;
			if(in_array($name,$excluded_ids)) return true;
			$categories=get_the_category();
			foreach($categories as $category){
				$cat_id=$category->term_id;
				$cat_slug=$category->slug;
				$cat_name=$category->name;
				if (in_array($cat_id,$excluded_cats)) return true;
				if (in_array($cat_slug,$excluded_cats)) return true;
				if (in_array($cat_name,$excluded_cats)) return true;
			}
			return false;
		}

So the function can say "don't include if the item is a post title or post name," but can you think of a way to say "don't include if the item is an image caption?

Solange4 on "Redirecting Virus"

$
0
0

Yes we have been having a problem with this web site: [ Link redacted, please do not post that here ] redirecting us from our own web site. Our own web site is: http://www.solange4.com. We cannot promote or log on to our web site after about
5 o’clock. Is there anything we can do to stop this because someone on their team has planted a virus in our web site.

rkapoor45 on "Is my website hacked?"

$
0
0

I am seeing this ad from the website Webcare360 on our website The Voice of Nation and I dont know what caused my website to show these unwanted ads? I feel like this is because of some of the plugins misbehaviour that I have been using. Kindly let me know how to get rid of this problem?

ben83 on "How to get two thumbnails sizes in a custom loop ?"

$
0
0

Hi everybody,

I need help to set two differents thumbnails sizes; A big one for the last article, and then, normal ones.
Here is my custom loop, in order to identify the last post as "featured". Right now, there is just one thumbnail size both for "featured" and "regular".

<?php while (have_posts()) : the_post(); ?>
<?php if (is_paged()) : ?>
<?php $postclass = ('regular'); ?>
<?php else : ?>
<?php $postclass = ($post == $posts[0]) ? 'featured' : 'regular'; ?>
<?php endif; ?>
<div class="<?php echo $postclass; ?>">
<div class="thumbnail">
	<!-- post thumbnail -->
		<?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>
			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
				<?php the_post_thumbnail(array(583,420)); // Declare pixel size you need inside the array ?>
			</a>
		<?php endif; ?>
		<!-- /post thumbnail -->
</div>
<detail>
		<!-- post title -->
		<h2>
			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
		</h2>
		<!-- /post title -->
<!-- post details -->
		<span class="date"><?php the_time('F j, Y'); ?> <?php the_time('g:i a'); ?></span>
		<span class="author"><?php _e( 'Published by', 'html5blank' ); ?> <?php the_author_posts_link(); ?></span>
		<span class="comments"><?php if (comments_open( get_the_ID() ) ) comments_popup_link( __( 'Leave your thoughts', 'html5blank' ), __( '1 Comment', 'html5blank' ), __( '% Comments', 'html5blank' )); ?></span>
		<!-- /post details -->
		<?php html5wp_excerpt('html5wp_index'); // Build your custom callback length in functions.php ?>
		<?php edit_post_link(); ?>
</detail>
	</div>
<?php comments_template() ?>
<?php endwhile ?>

I tried some stuffs but it doesn't work. I am a beginner in PHP ! :-/
If you could help... Thanks in advance.

Viewing all 8245 articles
Browse latest View live




Latest Images