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

ramooch on "Keep params in url when navigate?"

0
0

Hi, i have this link that i use in an email marketing

http://plancero.net/citroen/?utm_source=BAODATA&utm_medium=email&utm_content=C3BERLINGO&utm_campaign=DARC

Got a form that tells me the medium that the visitor used to reach to the website, like email, facebook, twitter, etc.
The problem is that if the visitor leaves the page the parameters dissapear and i cant keep track of the medium

I want to keep

/?utm_source=BAODATA&utm_medium=email&utm_content=C3BERLINGO&utm_campaign=DARC

or at least the utm=medium

How can i do that?
Thanks in advance and sorry for my english


Free269 on "adding separator"

0
0

Hi,

I'm working on a new theme based on the twentyfourteen theme.
I want to add some dot separators on the main navigation menu.
So I rewrote this line in the head:
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu', 'link_after' => '</a> ·' ) ); ?>

the problem is that it adds a dot on the last loop
Ex:
Home - About - Info - Cars - Buses -

Any ideas how to solve this?

elelel on "Having to prove I'm human when I log in? Have I been hacked?"

0
0

Hello
I'm a wordpress newbie but I've taken time to try to protect my site from hacks and I'm constantly reading and trying to take it all in. Anyway to my point. I know you can get plugins which make you prove you're human to log in etc. but I don't have one of these installed and yet just now I had to do a little maths sum to log in to my wordpress site.

I've looked through my plugins and can't find anything of that type which has been installed. I use Bruteprotect which seems to be down and so I can't see on my dashboard if there has been a lot of people attempting to hack or log in.

Is this something which wordpress just enforces itself or is it likely I have an intruder? How do I find out? I go on vacation tomorrow and the last thing I need is having to spend hours upon hours trying to figure out coding things which I do understand.

Panic!

Free269 on "Add sidebar to tablets - using my own custom twentyfourteen theme"

0
0

Hi guys,

I'm working with the twentyfourteen theme.. changing it to what I would like it to look like..

so using the mobile view, I disable the view of the sidebar by using this:

if (wp_is_mobile() == false){
	get_sidebar();

}
	get_footer();

wp_is_mobile() function just gives back a true or false answer.
How can I check if it's a tablet using PHP so I could add an other "if".

or if you know any other way to do this.. I'll be happy to listen

tnx

a4jp.com on "Can someone see why my inspiration menu drop down doesn't show up?"

0
0

I made my own child theme to a theme and now it looks nothing like the original but I some how turned off the drop downs of the top main navigation. I can see the bits in the code so they are there but they just don't show on the mouse over. Can someone see why they don't show up?

Regards,

Glen

http://a4jp.com

AliceWonderFull on "Prepared Statements"

0
0

http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/

Says prepared statements require two arguments.

I don't understand something, it looks like it requires you to pass the argument at the time you prepare the statement?

in PDO you do something like

$sql = 'DELETE FROM ' . $this->sqltable . ' WHERE tid=?';
$q = $this->pdo->prepare($sql);

Then later you can use it by calling

$q->execute($arg)

You can't do that with WordPred $wpdb prepared statements? You have to know the argument(s) at the time you prepare it?

That seems wrong, what am I missing?

garciasanchezdani on "wp enqueue scripts don't work"

0
0

Hi all, I'm using it in a single post, like this:

add_action( 'wp_enqueue_scripts', 'wp_add_unit_scripts' );
function wp_add_unit_scripts() {

    global $post;

    wp_register_script('unit_more_widgets_scripts', WP_PLUGIN_DIR.'/js/funcionalidad.js', array( 'jquery' ));

    if($post->post_author == ID_USUARIO){
        wp_enqueue_script('unit_more_widgets_scripts');
    }
}

I'm calling it just after get_header ... but I'm debugging and the code inside the function isn't executed...

What I try is to add some javascript in one single post, only if this post has been created by determined user...

Thanks, Daniel

HuddersfieldH on "Calling information from database into tables."

0
0

Hi,

I'm wanting to have a table on my site that allows me to see the sub directory, blog id and mapped domains in a table.

So far I've got how to show the blog id and directory from main domain, but can't get the recalling mapped domains bit right.

I'm using the main domain mapping plugin.

The code I use to recall the current info is as follows:

$con=mysqli_connect("localhost","USER","PASSWORD","DATABASE");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM hh_blogs");

echo "<table border='0'>
<tr>
<th>Blog ID</th>
<th>Address</th>
</tr>";

while($row = mysqli_fetch_array($result)) {
  echo "<tr>";
  echo "<td>" . $row['blog_id'] . "</td>";
  echo "<td>" . $row['domain'] . "" . $row['path'] . "</td>"; }
  echo "</tr>";
echo "</table>";

mysqli_close($con);

I want to recall the relevant domain(s) in the third column from hh_domain_mapping.

You can see what I've done at
https://huddersfieldhosting.co.uk/bloglist

You need to login first though at
https://huddersfieldhosting.co.uk/clients

(If you don't login you'll get bounced to the clients page)

Thank you


Alvaro on "Remove "category" word from URL"

0
0

Hello
I am trying to create an SEO friendly URL structure for my website.
I an trying to have an URL witohut thr word Category and parent category name for example
I have the below category structure
Category 1
-category 2
-category 3
--category 4
By default my category structure is
for 1st level category
http://www.mysite.com/category/category-1
For second level category
http://www.mysite.com/category/category-3/category-4

What I am trying to achieve is a URL structure like below
for 1st level category
http://www.mysite.com/category-1.html
For second level category
http://www.mysite.com/category-4.html

Till now I have achieved is
For second level category
http://www.mysite.com/category-4
The code I am using is

add_filter( 'category_link', 'wpse7807_category_link', 10, 2 );
function wpse7807_category_link( $catlink, $category_id )
{
    global $wp_rewrite;
    $catlink = $wp_rewrite->get_category_permastruct();

    if ( empty( $catlink ) ) {
        $catlink = home_url('?cat=' . $category_id);
    } else {
        $category = &get_category( $category_id );
        $category_nicename = $category->slug;

        $catlink = str_replace( '%category%', $category_nicename, $catlink );
        $catlink = home_url( user_trailingslashit( $catlink, 'category' ) );
    }
    return $catlink;
}

Please help me out in creating the desired structure

Thank in advance

AvWijk on "[Audio Embeds] Automatically create download link?"

0
0

I'm maintaining the website of a choir and I use the Insert Media functionallity to insert MP3 audio to a post.

As you al know that looks something like this: [audio mp3="http://www.somesite.com/wp-content/uploads/2014/06/FIELDS-OF-GOLD-S1.mp3"][/audio]

Unfortunately it's not possible from the front-end to download the track, only to play it. It's a closed off members-only website and members should be able to download own recorded material, so that covers the whole legal thing.

Is there any way in functions.php to change this

[audio mp3="http://www.somesite.com/wp-content/uploads/2014/06/FIELDS-OF-GOLD-S1.mp3"][/audio]

to this, in an automated way?

[audio mp3="http://www.somesite.com/wp-content/uploads/2014/06/FIELDS-OF-GOLD-S1.mp3"][/audio]
<a href="http://www.somesite.com/wp-content/uploads/2014/06/FIELDS-OF-GOLD-S1.mp3">Download FIELDS-OF-GOLD-S1.MP3</a>

dotnet630 on "How to add Video Meta Data while using Yoast Seo Plugin"

0
0

Hi all I am using Yoast SEO Plugin for the SEO,
But i am in need of adding Schema code for the video pages of my site,
Yoast is having a paid plugin for video which i cannot afford,whats the best solution to my prob,
how to meta data(schema) of Video while using Yoast plugin....
Regards
Praveen dotnet630{at}gmail

brian1037 on "Prevent the "Cheatin' uh?" error over CURL"

0
0

I am working on an API for a WordPress site. Basically, an external application (not made using WP) is able to send JSON to a file I made (api.php) and inside that file I load WP (using wp-load.php), and create a post (custom post type) based on the received JSON.

When I reach this block of code...
-------------------------
$formation_fr = wp_insert_post( array(
'post_type' => 'formation',
'post_title' => 'example post',
'post_status' => 'publish',
'post_author' => 2 // This is an admin account associated with this ID
) );
-------------------------
... the post gets created, and everything works except for the post_author (instead, there is no author for the post). But, my external application that sent the CURL request will receive this:
-------------------------
Error: call to URL http://domain.com/api/api.php failed with status 500, response

Alors, on triche ?
, curl_error , curl_errno 0`
-------------------------
The "Alors, on triche?" error is the "Cheatin' uh?" error in French. WordPress for some reason thinks that I'm trying to circumvent capabilities.

If I try to log in the user (ID: 2) programmatically with this block of code...
-------------------------
private function login( $id )
{
$wp_account = get_user_by( 'id', $id );
$username = $wp_account->data->user_login;
wp_set_current_user( $wp_account->ID );
wp_set_auth_cookie( $wp_account->ID );
do_action('wp_login', $username );
}
-------------------------
... then I get this:
-------------------------
Error: call to URL http://domain.com/api/api.php failed with status 500, response , curl_error , curl_errno 0
-------------------------
Which is basically the same error as above but without the "Cheatin' uh?". I didn't expect that to work though, because AFAIK a cookie won't affect a CURL connection.

So, how can I avoid running into capability errors when working over CURL? I've used wp_insert_post() many times before and never had this issue. My temporary hacky solution is to erase the wp_die() function, which fixes the issue obviously.

WordPress version is 3.9.1

peterk900 on "Load cookie value into search box"

0
0

I want to use Wordpress to provide help information from another (non-browser platform) system. This system can set a cookie - can someone start me of in the right direction to create a button/link on a Wordpress page which will either place the cookie value in a search box, or even better, if the cookie has a page_id, to load that page in Wordpress ?

Any help appreciated ! Thanks.

CroiSciento on "Post thumbnail in $_POST array?"

0
0

Hello,

I'm making a basic php basket and i'm trying to retrieve different informations. So far so good I got the title, the content, the permalink everything is working at intended. But i'd like to save the_post_thumbnail in an input hidden like this :

<input type='hidden' name='thumbnail_image' value="<?php the_post_thumbnail(); ?>" />

The problem is that it returns me a number. But I've basically never done this in the past even with a basic image. So how should I proceed save this picture in my array?

Thanks for your help.

zebrastribe on "Exclude categoies from wp_list_categories?"

0
0

Hi all

I am using this from the codex:

<?php
$taxonomy = 'category';

// get the term IDs assigned to post.
$post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
// separator between links
$separator = ', ';

if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) {

	$term_ids = implode( ',' , $post_terms );
	$terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids );
	$terms = rtrim( trim( str_replace( '',  $separator, $terms ) ), $separator );

	// display post categories
	echo  $terms;
}
?>

[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

But I have a hard time adding a exclude to hide some categories from the list.
I tried this:
$terms = wp_list_categories( 'title_li=&exclude=1&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids );
and
$terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids . '&exclude=1');

Why is the category not excluded from the list?


Olly343434 on "Can't load my script in WP"

0
0

Hi,

I have been trying to add a scriptto my site that depends on jquery, but I can't get it to work. Any help would be much appreciated. Thank you.

Here's what I have in my functions.php:

/*Adds accordion script*/

function accordion_script(){
      wp_register_script('accordion', get_template_directory_uri() . 'http://kubetest.kube.co.uk/wp-includes/js/accordion-script.js', 'jquery');
      wp_enqueue_script('accordion');
    }

add_action( 'wp_enqueue_scripts', 'accordion_script');

Here is the contents of accordion-script.js:

$j(document).ready(function(){

var $j = jQuery.noConflict();

  $j(function($) {

	var allPanels = $j('.post-list > li > .entry-summary').hide();

	$j('.post-list > li').click(function() {
	  allPanels.slideUp();
	  $j(this).parent().next().slideDown();
	  return false;
	});

  })(jQuery);

});

playgraph on "[Theme P2] Categories in hidden post field"

0
0

I'm setting up P2 theme so that the post field displays in category pages.

I can get the category id from the page and all I want to do is simply add it to the post form.

In the post-form.php file, I've placed
<input type="hidden" name="post_category" id="post_category" value="<?php echo get_category(get_query_var('cat'))->cat_ID; ?>" />

right under this line:
<input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />

I can view source and verify that the post_category is indeed being set in the hidden post field, but the post is not being sent to the correct category. It just goes to the default category. Is this a nonce issue?

Please advise! Thanks!

https://wordpress.org/themes/p2/

Slimmons on "Adding link to resume's in database from Resume Submissions and Job Postings"

0
0

I have a plugin called Resume Submissions and Job Postings, and I really like it. In the plugin there's a way to send someone an email of the submission, and right now it sends a text email with a pdf attachment. I'm editing it to take the pdf out of the equation, and I'm pretty new to editing wordpress plugins. Basically I have the database location of the resume '/uploads/rsjp/attachments/'.

Here's the problem: I don't know how to add a link to the submissions.php file.

I've tried including something like
<a href='/uploads/rsjp/attachments/'>
but like I said, that doesn't seem like it should work, but it was a stab in the dark for a new developer.

AliceWonderFull on "Add JS to admin panel"

0
0

Hi, I'm sure this is just a simple matter of knowing what the action is, but I've so far not found it.

Have a plugin. Need to create options page. Options page is added via

function sexycalAdminMenu() {
	add_options_page('Birthday Calendar Administration', 'sexyBdayCal', 'manage_options', 'sexyBdayCal', 'sexycalAdminOptions');
}
add_action('admin_menu', 'sexycalAdminMenu');

That part works beautifully, but I want to add some JS which I obviously only want loaded when the options-general.php?page=sexyBdayCal is active.

I'm having trouble figuring out which add_action I need to use to accomplish that. I'd prefer to add it in the head and not the footer, just because I'm a purist snob.

Thanks.

jasperg on "adding mark up to woo commerce product categories"

0
0

I have been trying to style my product category list but to do so means I need to add a some mark up to them.

Ok just to sum up what I want to achieve seeing as I have been doing this for a week and maybe on completely the wrong path.

I want to add classes to current category and current category ancestors
I would also like to add mark up to the < a> tags as well. I have been reading about "walkers" all week and still got almost no clue.

I a using woo commerce and I can get it working by adding the mark up to
class-product-cat-list-walker.php

public function start_el( &$output, $cat, $depth = 0, $args = array(), $current_object_id = 0 ) {
		$output .= '<li class="cat-item cat-item-' . $cat->term_id;

		if ( $args['current_category'] == $cat->term_id ) {
			$output .= ' current-cat';
		}

		if ( $args['has_children'] && $args['hierarchical'] ) {
			$output .= ' cat-parent';
		}

		if ( $args['current_category_ancestors'] && $args['current_category'] && in_array( $cat->term_id, $args['current_category_ancestors'] ) ) {
			$output .= ' current-cat-parent';
		}

		$output .=  '"><a href="' . get_term_link( (int) $cat->term_id, 'product_cat' ) . '" class="btn btn--small  btn--full  catagory-menue__btn"  >'  . __( $cat->name, 'woocommerce' ) .  '</a>';

		if ( $args['show_count'] ) {
			$output .= ' <span class="count">(' . $cat->count . ')</span>';
		}
	}

I added my mark up and it works. But it is not ideal as then I cannot update easily . I tried copying the code for the whole walker to my functions.php file on my theme and changed

class WC_Product_Cat_List_Walker extends Walker
to
class Book_Cat_Btn extends Walker
to keep it form getting confused. This worked! which was amazing till I realised I no longer have some of the classes that woo commerce had added to my category list.

it seems to me that it all works apart from

if ( $args['current_category_ancestors'] && $args['current_category'] && in_array( $cat->term_id, $args['current_category_ancestors'] ) ) {
			$output .= ' current-cat-parent';
		}

Is there any way I can get this to work? I assumed current_category_ancestors was part of WordPress code but it seems not and I have no clue how to replicate what ever is making it work.


It looks like this may do what I want but I am having trouble working it out

thanks for any help anyone can give me. Even a online lesson or a book i can get that would tell me what is going on, I just completed code academy PHP and it helped but i am still at the stage where I don't even know what to ask most of the time

Viewing all 8245 articles
Browse latest View live




Latest Images