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

myminds on "Dynamic links pointing to the same page"

$
0
0

Hi guys. I want to create a link in all the articles with the following structure:
http://site.com/link/<?php the_title(); ?>

What can i do to point all the generated links to the same page? I have a dynamic page that is updating with some information but the link is the same: http://site.com/static-page

Is there any possibility to send all the links to the same dynamic page? Thanks.


PlutDem on "Outputting HTML code outside meta boxes?"

$
0
0

Hello, is it possible to output HTML code outside meta boxes?

dano421 on "ad links"

$
0
0

I am getting text-enhance links on random words on my website, it is not isolated to my own computer but somehow embedded in my website. I've asked my web hosting service for advice & so far they have not offered any. There must be a solution to this, here is the website:
http://peaceracing.com Links are on words such as "registration", etc. and link to an ad. If anyone has any info on how to fix this I would be very grateful.

Thanks

jayo on "oEmbed or video Embed code with custom field"

$
0
0

Been trying to figure it out for a long time, but cant.

Im trying to achieve, being able to use a custom field to post videos, but to output a video using the Oembed option or using an embed code (so, you can post a video that's not from Youtube, or Vimeo, etc).

Here's what I have so far. Works fine, in posting an embed code, but if you place a youtube URL or vimeo url in the custom field, it just spits out the URL and doesnt use the Oembed ability to embed the video clip.

<?php if(has_post_format('video')) { ?>
<?php
if ( get_post_meta($post->ID,'customfield', true) === 'iframe' || 'object' || 'embed' ) {
echo get_post_meta($post->ID,'customfield',true) . '<br /><br />';
} else if (get_post_meta($post->ID,'customfield', true) === 'http://youtu.be' || 'http://vimeo.com' ) {
echo wp_oembed_get( get_post_meta($post->ID, 'customfield', true)) . '<br /><br />'; }
?>
<?php } ?>

chazbeaner on "Variable Not Working Inside is_author() Array"

$
0
0

I'm using a plugin (User Groups) to separate out users into, well, groups, and I need to figure out a way to create a conditional to check if an author is in a certain group. So, using get_term_by and get_objects_in_term, I was able to build a string of author IDs. See below:

$taxonomy = 'user-group';
$taxonomy_group_name = 'author-group';
$taxonomy_group_id = get_term_by('slug' , $taxonomy_group_name, $taxonomy, 'OBJECT');
$taxonomy_group_ids = get_objects_in_term($taxonomy_group_id->term_id, $taxonomy);
$taxonomy_id_list = implode(',', $taxonomy_group_ids);

So, I can take the list stored in $taxonomy_id_list and echo it out and get a string that looks like the below:

1,2,3,4,5,6,7

For the conditional, I should then be able to say:

if(is_author(array($taxonomy_id_list))) { }

But that doesn't work. If I paste the raw list into the array, it works as it should, but if I try to use the variable inside the array, the conditional does not work.

What am I missing? Why wouldn't that variable work?

samcrawshaw on "basic if statement"

$
0
0

Yo mo fo's,

I've done a duplicate post over in the Plugins section.

I've flummoxed myself with an if statement. Here is my code:

if (is_page(64)){
	$recent = new WP_Query("page_id=64");	//Define the post
	while($recent->have_posts()) : $recent->the_post();	//Start the loop
		the_content();	//Get the content
		endwhile;}	//End loop

When I run the statement I get the 404 page. It pulls in the post out of the if statement.

I am using wp_nav_menu() to call in the navigation. Should this matter?

It did work at one point but I'm struggling to fathom what I did wrong. I am also using the wp_reset_query in the footer.

The url reads /contact but is pulling in the 404 page.
N.B. 64 is id of my contact page (not post).

Thanx for looking,
Sam

TITLE EDIT: Couldn't spell.

ChrisColston on "wp_query_posts and masonry script"

$
0
0

Hi, bit of a newbie to the coding side of things and have inherited a blog site which I'm trying to customise utilisiing the jquery masonry script. Got the custom template all set up here:
http://www.mommaloves.net/?page_id=1834

I have 2 issues I want to resolve,

1. the masonry script, although loading all posts, you'll notice that the display goes awry after the first few posts, I've check that the posts have been created correctly so could this be some sort of cache/memory issue?

2. The idea of the page being that the last sticky post is diplayed at the top across the width of the mainn container, I've got this working

<div id="sticky">

 <?php
	$sticky = get_option( 'sticky_posts' );
	rsort( $sticky );
	$sticky = array_slice( $sticky, 0, 1 );

if (is_numeric($sticky[0])) {
	/* Query sticky posts */
	query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) );
		while ( have_posts() ) : the_post();
		the_post_thumbnail( array(920,540), $attr );
		the_title('<h3>', '</h3>');

		if($post->post_excerpt) :
			the_excerpt();
		else:
			the_content();

		endif;
		endwhile; // End the loop. Whew. 

	wp_reset_query();
}
?><div>

I'm needing to emulate how the links on the masonry bricks work ie, adding permalinks to the post? and ideally to exclude this post from being displayed by the masonry script.

Any help, greatly appreciated.

(Custom child theme of twenty twelve)

rgds

fallenpeace on "Use wordpress's login for outside standalone application?"

$
0
0

Okay basically, I have a music project I picked up from a friend that ive been working on for the the past couple of weeks. Its divided into three parts, A main website (powered by wordpress) - a custom user panel (powered by codeigniter) - and a radio/music player (Powered by codeigniter).

Oddly enough, all three parts have their own login system. So users need to register on each separate area which is horrible. I am not worried about the custom user panel because that is being removed and we will just be themeing the original wordpress dashboard to our liking.

Basically I want to combine the radio/music player with the wordpress login/register system so the usernames and passwords are the same throughout the main wordpress site and the musicplayer.

The radio uses a basic login/register system and here's the corresponding functions:

public function uregister() {
    $this->load->helper( array('form') );
    if( $_POST['submit'] ) {
        $data = array("ra_fullname"=>$_POST['fname'],
                      "ra_email"=>$_POST['uemail'],
                      "ra_password"=>$_POST['upassword']);
        $this->db->insert('ws_radio_user', $data);
        redirect( site_url() );
    }

    $data = array();
    $this->load->view('user_register', $data );
} 

public function ulogin() {
    $this->load->helper( array('form') );
    if( isset( $_POST['submit']) ) {
        $data = $this->db->query("select * from ws_radio_user where ra_email = '".$_REQUEST['lemail']."' and ra_password = '".$_REQUEST['lupassword']."'")->row();
        if( $data ) {
            $sess_array = array(
                            'id' => $data->uid,
                            'username' => $data->ra_email
                          );
            $this->session->set_userdata('logged_in', $sess_array);
            redirect('http://radio.#.com');
        } else {
           $data = array();
           $data['error'] = "username password does not match";
           redirect('http://radio.#.com');
        }
    }

    $data = array();
    $this->load->view('login_view', $data );
}
public function logout() {
    $this->load->helper( array('form') );
    $this->session->unset_userdata('logged_in');
    $this->session->sess_destroy();
    redirect('http://radio.#.com', 'refresh');
}

I am nowhere near a professional when it comes to php, so any insight would be extremely helpful, in replacing this login (which obviously only reads and writes plaintext) with the wordpress login system.

Also both the wordpress tables and the radio tables are in the same database ^.^


Swayne3 on "Adding custom attribute to [gallery] shortcode"

$
0
0

Hi,
I'm modifying one WP theme and I'd really like to add a simple attribute to gallery shortcode whether to crop image thumbnail or not. And then in the process of creating a thumbnail I would like to just specify

if crop == 'yes' { do this }
else { do that }

Is that possible? And if so than how? Thanks for any answer!

Edit:
Theme has it's own registered gallery shortcode with some modifications I think, but I simply can't make this work...

disinfor on "Merging get_posts returned arrays"

$
0
0

I've searched everywhere and can't quite wrap my head around a particular issue I'm working on.

What I'm trying to do is get all the images belonging to a particular custom post type and category. I've got it worked out already where it returns the separate arrays for each post in that custom post type. However, I actually have the need to randomize the order of the images that are returned.

Currently, the posts are returned randomly (e.g. Post 1, Post 2 and Post 3 will return and display in a random order) and the images per post are randomized as well (e.g. Post 1 images will return in a random order), but they are still grouped by post (Post 1 images do not get intermixed with Post 2 images and so forth).

What I need is it to be a random order where it displays images like:
Post 1 - Image 2
Post 2 - Image 3
Post 1 - Image 1
Post 3 - Image 4
Post 2 - Image 5

http://pastebin.com/0VsfYBFW

In the pastebin is what I currently am using. I also have another version using a custom WP_Query, but I get the same results, as the foreach() will output an array for the first post, then an array for the second post, etc.

Is there a way to merge the arrays returned from get_posts() and then work through that with a foreach()? Or am I missing something completely simple.

rekkette on ""Asides" post directly to Twitter"

$
0
0

I'm wondering about the mechanics involved in linking "Aside" posts to directly post to your Twitter account.

I actually have never looked at to plugins that post you twitter feed onto your Wordpress page, but it should be possible if you manipulate a similar code, right?

What about going the other way. Do you think it would be possible to have Tweets post directly as "Asides" on you blog page?

Really just a philosophical question... would be cool, though.

Wierdbeard65 on "add_filter('wp_nav_menu_items' not working?"

$
0
0

Hi,

I'm trying to add a login option to the main menu bar of my theme. Virtually all the solutions I have found with google amount to the same method, which is to add a function to create the entry and call that function by adding something like:
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
to my functions.php (where add_login_logout_link is the name of my function.
My problem is that the link never shows up. I did a var-dump of the wp_filters and it is getting added, so...?

Anyone else had this problem / got it working?

Thanks!

Owen on "How to make favicon show on register/login page?"

$
0
0

I currently have a favicon on every page of my site(including the admin) except the register/login page. On there for some reason the oldest favicon on my site is there a modification I can make so the RIGHT favicon will show?

petermae on "Parsing only first line of posts with php (before a )"

$
0
0

I need to extract the first line of the content of my posts with php. I also need to extract a number of characters fron the rest of the post.

E.g. my post content structure looks like this:

http://google.com/or-some-other-random-link

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec cursus quam at est lobortis, id euismod augue venenatis. Fusce quam nisl, aliquam vitae porta vel, dapibus ut augue. Etiam ultricies sem sed lacinia adipiscing. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

I'm not very well travelled in PHP, so I'm a bit at a loss. Should I do this with a loop of some sort? One that will end when it meets the
code? Or is there a better way?

Kase on "Rave Player Plugin for Wordpress"

$
0
0

Hi,

I am trying to embed a Rave (Media) Player into my site.

The site is using the - deTube - Professional Video WordPress Theme -

I have embedded the player in my home page but it is automatically wrapped in a <video-wrap> tag.

This means that the player is displaying as a Video Player Screen instead of a round play button.

I guess that this is an automatic treatment of the <object> tag.

How can I prevent this happening (just for the player)?

URL is http://rootstube.webdesignkase.com/

Thank you in advance for your help.

Kase


Blaxsun on "get_terms() with javascript?"

$
0
0

Hey guys,

I have the following situation:
For one of my Websites I need a extended Searchform (taxonomy picking). This is my code, so far:

<select id="hersteller" name="hersteller" onchange="showTextBox(this.value)+showcategory(this.value)">
<option value="Hersteller">Hersteller</option>
<?php $terms = get_terms('category');
foreach ($terms as $term) { printf( '<option id="hersteller" class="level-0" value="%s">%s</option>', $term->slug, $term->name ); </select>

<div id="modell" style="display:none">
<select name="Modell">
<option value="Modell">Modell</option>
<?php $terms = get_terms('marke-<strong>HERE GOES THE SELECTED CATEGORY</strong>'); 

foreach ($terms as $term) { printf( '<option class="level-0" value="%s">%s</option>', $term->slug, $term->name ); } ?>
</select>
</div>

Inside get_terms('') some javascript needs to pick the selected category name. For this I tried a function:

get_terms('marke-'.'<script type="text/javascript">
function showcategory(made){document.write(hersteller.options[hersteller.selectedIndex].value;
}</script>'.'');

It did not work at all, I tried so much more, but nothing helped. Does anyone have an idea? I am very happy about any suggestion!!

Cheers Felix

mrfraz on "get last comments | with pop-up link"

$
0
0

hey,

i found a code snippet for last comments on a static page:
but i use comments only with a pop-up.

<?php comments_popup_link('0 Comments', '1 Comment',
'% Comments', 'comment-link-top', 'Comments closed.'); ?>

could anyone help me to use the pop-up-link above in the code?
that would be great :-)

<?php
$comments = get_comments('status=approve&number=5');
  foreach($comments as $comment) :?>

  <?php $my_id = $comment->comment_post_ID ; $post_id_comms = get_post($my_id); $title = $post_id_comms->post_title;?> 

    Who: <?php echo($comment->comment_author);?><br />
    About: <a href="<?php echo get_permalink($my_id) ?>#comment-<?php echo $comment->comment_post_ID?>" title="on <?php echo $title ?>"><?php echo $title ?></a><br />
    What they said: <?php echo($comment->comment_content);?><br />
    When they said it: <?php echo($comment->comment_date);?><br />

  <?php endforeach;?>

Kimber254 on "Trying to learn enabled to disabled."

$
0
0

Hi, I'm a bit scared to make changes and need help learning what to look for. This is my first attempt at changing codes in a plug-in without a tutor to work from.

I bought WooCommerce Custom Product Tabs from terrytsang. It works great but in "add product" page all the tabs I added are default enables and I want default disabled. Right now I have to uncheck all the tabs I don't want and of course it would be quicker to only have to check the ones I want to us depending on products.

The box I need to change shows up in the advance add product section of the product data.

I have the php open and found several enable however I think it is one of more of these codes.

Do I need to change true to false

$enabled = get_post_meta($post_id, 'enabled_tab_'.$post_id.'_'.$post_index, true);

if($enabled == 0 && $enabled != "")
$this->woocommerce_wp_checkbox_input(array('tab' => $post_index, 'id' => $post_index.'_tab_enabled', 'label' => __('Enabled', 'custom_product_tabs'), 'value' => false, 'class' => 'checkbox'));
else
$this->woocommerce_wp_checkbox_input(array('tab' => $post_index, 'id' => $post_index.'_tab_enabled', 'label' => __('Enabled', 'custom_product_tabs'), 'value' => true, 'class' => 'checkbox'));

$this->woocommerce_wp_textarea_input(array('tab' => $post_index, 'id' => $post_index.'_tab', 'label' => __('Content', 'custom_product_tabs'), 'placeholder' => __('Place your content here', 'custom_product_tabs'), 'value' => $tab['custom_tabs'], 'style' => 'width:70%;height:21.5em;'));
echo '</div>';

Any advice and if so, can you explain the how or why to me.

mtucker on "How To Display Price and Product Name On Rollovers from Woocommerce"

$
0
0

Hello,

I am looking to create an image hover that displays information that is stored from WooCommerce (like price and product name). Here is an example of exactly what I am looking for:

http://shop.herriottgrace.com/ (When you roll over the images the price and

Is there a bit of javascript that could retrieve that information and display when the image is hovered? I know how to change opacity in CSS, but I am lost as how to retrieve that information that I enter for each product in WooCommerce. Any help is greatly appreciated!

Cheers,

Matt

HellCoder on "Modifying title of other widgets"

$
0
0

Hello. Is there a way, to modify title or before_title and after_title with plugin? How?
Thanks

Viewing all 8245 articles
Browse latest View live




Latest Images