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

kikimarie123 on "Next/Previous Posts Link with Custom Post Type"

$
0
0

I'm using custom post type to query all the posts from post type: 'news-articles' and under a specific meta value. I've tried everything to get some next/previous links to appear and nothing is working.

Here is my code:

<div id="news-articles">
<?php
$args = array(
	'numberposts' => -1,
	'posts_per_page'  => 5,
	'post_type' => 'news-articles',
	'meta_key' => 'release_type',
	'meta_value' => 'In the News'
);

$the_query = new WP_Query( $args ); ?>

<?php if( $the_query->have_posts() ): ?>

	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

		<div class="news-article" id="in-the-news">

		<div class="investment-image">

		<?php $associations = get_field('associations');
		if( $associations ): ?>

		<?php foreach( $associations as $association): ?>
			<?php
			$photo = get_field('investment_logo', $association->ID); ?>

			<a href="<?php the_permalink() ?>" title="<?php printf(__('%s','rys'), get_the_title()) ?>" rel="bookmark">
			<img src="<?php echo $photo['url']; ?>" alt="<?php echo $photo['alt']; ?>" />
			</a>

		<?php endforeach; ?>

		<?php endif; ?>

		</div><!-- .investment-image -->

		<div class="news-info">

		<strong><a href="<?php the_permalink() ?>" title="<?php printf(__('%s','rys'), get_the_title()) ?>" rel="bookmark" >
		<?php the_title(); ?></a></strong><br>

		<em><?php the_field('publication_source'); ?></em><br>

		<span><?php echo get_the_date(); ?></span><br>

		<a href="<?php the_permalink() ?>" title="<?php printf(__('%s','rys'), get_the_title()) ?>" rel="bookmark" class="more">more</a>

		</div><!-- end .new-info -->

		</div><!-- end .new-article -->

	<?php endwhile; ?>

<?php endif; ?>

<?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>
</div><!-- end #news-articles -->

<?php americsecur_entry_bottom(); ?>
</div><!-- end of #post-<?php the_ID(); ?> -->

        <?php
		endwhile; 

		get_template_part( 'loop-nav' ); 

	else : 

		get_template_part( 'loop-no-posts' ); 

	endif;
	?>     

<?php wp_link_pages('before=<p>&after=</p>&next_or_number=number&pagelink=page %'); ?>

</div><!-- end of #content-section -->

<?php get_footer(); ?>

Nothing is working. I've tried multiple different code snippets and still nothing. Please help!


Need_Help on "WP3.5 Media Uploader - Upload without post ID?"

$
0
0

In the past, the code below could be used to upload an image via post edit screen without having the post ID attached to it (by not defining the post ID) :

jQuery('.upload_slider_button').click(function() {
    tb_show('', 'media-upload.php?post_id=&type=image&TB_iframe=true&referer=matrix-settings');
    return false;
});

However, I wonder how can I achieve the same result now using the new Media Uploader in WordPress such that the uploaded image will not be ‘attached’ to the post ID? I’ve spent the whole day searching for an answer but couldn’t get anything useful. I have seen this post and it still adds the post ID when an image is uploaded via the post edit page.

Thanks for helping.

kitcorsa on "Direct Required - Flooring Site - E-commerce/booking"

$
0
0

Im looking for a bit of advice or direction here,

Im looking to make a site for my brother who is specialist flooring expert who can supply fit and repair floors. What i'm after doing is creating a restoration site for him which explains how he resorted and repairs old wood floors and preserves them. this part is straight forward enough etc, the wall i'm hitting and getting stuck on is an online quote / booking system which could have a payment (paypal option)

This service is fairly straight forward as my brother charges a set price per square meter, so what i'm trying to do is create a form where the customer can enter the width and length of there room, and get a quote, then send a booking email to my brother with the same information for my brother to contact them and arrange the appointment to go round, inspect and perform the job.

The next problem is what if the customer has more than one room?? is there a way of adding a room 2 room 3 etc etc etc if required.

We have also though about taking an online deposit via paypal for say 10%, we would not be able to take the full amount as the customer may enter the wrong size trying to get a cheaper job done, or over changed by not measuring correctly. Deposit first and final payment on completion would be better if possible.

Could anyone please point me in the right direction please. Thank you

lionsdendesigns on "How To: Show Attachments only for Today matched to Filename"

$
0
0

Hello!

Need help with my code. I have several PDFs and PPTs all named by their date in the filename. YYYY-M-D.pdf with no leading zeros. I would like today's date of M-D to match the filename's M-D and use substr() to remove the first five characters of the filename to check for the match. Then it needs to list only those that match the today's date and provide a link that opens in a new window. Each link is separated by a space and showing the full filename without the extension, using glob() to find a match if necessary.

<?php
date_default_timezone_set('America/New_York');
$todayNoYear = date('n-j'); // Month - Day
$args = array( 'post_mime_type' => 'application/pdf', 'post_type' => 'attachment', 'posts_per_page' => -1, 'post_status' => 'any', 'post_parent' => null );
$attachments = get_posts( $args );
$attachmentTitle = apply_filters( 'the_title' , $attachment->post_title );
$titleNoYear = substr($attachmentTitle, 5);
if ($attachments) {
	if ($todayNoYear == $titleNoYear) {
		echo 'PDF for Today: ';

		foreach ( $attachments as $attachment ) {
			$attlink = the_attachment_link($attachment->ID, false);
			echo $attlink.'&nbsp;';
		}
	} else {echo 'none';}
}	 

?>

Franz92 on "the_content vs the_excerpt: Theme, obey my will!"

$
0
0

Stop! Okay, carry on reading, but pssshhht.

Thank you for lending me your attention. The website uses a heavily modified version of the theme "News-Leak". (I should fork it somewhen, but I have no clue how. However, that is another topic.)

The theme displays posts on the front page differently. The first post gets an full-size image + excerpt (controlled via the more-tag). The other posts just show an excerpt of 20 words. I want the first post to show this behaviour, too.

This is the code of the first post:

<div id="post_holder">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="post_dets">
<div class="post_author"><?php if(get_the_author_meta('userimg') != ""): ?>
<img class="Autorenbild" src="<?php the_author_meta( 'userimg' ); ?>" width="40" height="40" />
<?php else: ?>
<img src="<?php echo get_template_directory_uri(); ?>/images/no_user_img.jpg" alt="<?php the_title(); ?>" width="40" height="40" />
<?php endif; ?>
<span>Geschrieben von:</span><span class="post_details"><?php the_author_posts_link(); ?></span></div>
<div class="post_time"><span>Geschrieben am:</span><span class="post_details"><a href="<?php echo get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')); ?>"><?php the_time('F j, Y') ?>
 </a></span></div>

<?php if (!empty($post->post_password)) {?><?php }else { ?><?php if ( comments_open() ) : ?><div id="comments_option">Meinungen<br  /><a href="<?php the_permalink() ?>/#leave-comment">Kommentiere</a><div class="comments-counter"><?php comments_popup_link('0', '1', '%', '', ''); ?></div></div><?php ; else : ?><div id="comments_option">Die Kommentare sind geschlossen.</div><?php endif; ?><?php } ?></div>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>><?php the_content('Lesen Sie mehr...'); ?>

<?php wp_link_pages( array( 'before' => '<p class="page-link">' . __( 'Pages:' ), 'after' => '</p>' ) ); ?>

<div class="post_category"><span>In der Kategorie:</span> <?php the_category(', ' ) ?><?php the_tags('<br /><span>Tags:</span>',' , ','<br />'); ?>    </div>

</div>

</div>

How do I modify it in a way, that it does as I pledge?

Comment: Simply switching "the_content" to the "the_excerpt" doesn't work. The picture then gets stripped from the front-page.

nickpalm on "Give all images in post a universal url link"

$
0
0

I'm making somewhat of an image roullette and am having trouble with one thing.

I'm looking to make all images on my site automatically link to the same url (mydomain/?random). I know there is a function for this, but I can't seem to find it.

Thanks!

adamsr on "custom taxonomy template show related posts"

$
0
0

I have a custom post type for contact directories with a custom taxonomy called "coach". Regular posts have categories with names matching the "coach" taxonomy. For instance, the basketball coach is marked as basketball under the coach custom taxonomy. On the contact directory for the basketball coaches, I want to show posts for the "basketball" category. Is there a good way to get this done? I don't want to add the categories to the contact directory, because I don't want the contacts to show up with the news.

Thanks!

dashrathng on "PHP with WP"

$
0
0

I am a beginner to WP and I have few questions on the same.

Is there a way to execute PHP scripts in WP without logging into the portal. I have created a portal page and written (only)PHP code in it using insert PHP plugin. I am trying to authenticate the user who logs in to my Android App by calling this script in my app. But every time I run this script/portal page directly in the browser, the page is redirected to log-in page. Is there a way to execute run the page with PHP without logging into the portal?


yalrighty on "Woocommerce and Open Graph meta tags"

$
0
0

Greetings,

I am a dummy when it comes to php code. I get by alright on my own but I'm definitely no expert.

I have 3.5.2 and woocommerce 2.0.12.

I am using a combination of itthinx.com's open graph protocol plugin and the Wordpress Social SEO booster plugins to generate various open graph tags that I need for certain functions I am using with social media sites. But one of the tags I need generated is for the price so that the store qualifies to use Pinterest's Rich Pins. I have every tag I need by modifying code here and there.

I need one more tag to generate for price which would look like this

<meta property="og:price:amount" content="15.00" /> where 15.00 would be the price of the product being viewed.

It must be something simple but I am unfamiliar with using hooks and pretty new to WP itself. Any help would be greatly appreciated.

chickster25 on "How to show on every page OTHER than home"

$
0
0

Hi,

I have inserted a yellow bar in my header which shows on every page but I do not want to show it on the home page as I already have a yellow bar in the slider.

The current code in my header area is just a DIv as follows:

'<div class="main-thing-yellowbar"></div>'

How can I add a function to tell it not to show this on the home page as I can only find code to show stuff on the home page but cant seem to get any to work without errors?

Thanks

heidekeal on "Nav without blog url"

$
0
0

[ Moderator note: please wrap code or log lines in backticks or use the code button. I've added the backticks to your post. ]

Hello,

I'm looking for a solution. I have a website that's pointed to an anoter domain. The problem is the main nav always links to the not pointed url. So i want to delete the url of the blog in the link;

<a href="/second-page/">

in stead of

</a><a href="http://school.nl/second-page/">

is that possible?

The menu code now

wp_nav_menu(
    	array(
    		'menu' => 'mainNav', /* menu name */
    		'menu_class' => 'nav',
    		'theme_location' => 'mainNav', /* where in the theme it's assigned */
    		'container' => 'false', /* container class */
    		'fallback_cb' => 'bones_main_nav_fallback', /* menu fallback */
    		'depth' => '2', /* suppress lower levels for now */
    		'walker' => new description_walker()
    	)
    );

crisbd1 on "How to reorder posts in wordpress"

$
0
0

[Please do not post in uppercase & shout at us. Post title de-capped.]

Hi I need to reorder the posts in my wordpress blog and I have installed several plugins which do that but they dont work. I found that I need to place 'hierarchical' => 'true' in my functions.php file on this link:

http://buckleupstudios.com/blog/custom-post-type-ordering-issue/

I have found this file opened it up but I don’t know where exactly to place the code? Can you please help

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

MARS1979 on "How to think about structuring a site with dynamic content"

$
0
0

First of all my apologies for not getting all of the terminology correct to perhaps pinpoint with more accuracy what it is i'm trying to say.

So hopefully this graphic will help anyone who reads this post and takes the time to answer it clearly see what i'm trying to accomplish.

Link to PDF of sitemap

re: sitemap - imagine 27 more neighborhood pages each with their respective child links and you start to see the repetitive pattern of how the site needs to work.

I'm sure it's been done a thousand times over but without the correct terminology i'll never be able to ask the right questions.

Even after reading hundreds of articles, posts, and forums i still haven't found anyone that has had this particular question and it makes me think that i'm either over-thinking the solution am really dumb that i need someone else to dumb it down for me:)

The site is an online magazine for a real estate company that has the following parent links on the navigation menu "HOME | NEIGHBORHOODS | BLOG | ABOUT US".
Here's the static HTML homepage : Homepage click here

I understand the blog part because that lends itself to the very thing that WP does so well so i don't have a problem with that or with ABOUT US (i realized that's a single static page), HOME is just a custom homepage (no blog posts on the home page).

It's NEIGHBORHOODS that i'm stumbling on understanding and here's the 2 main reasons why:

1) There are sub pages that stem from this parent menu item (Neighborhoods leads to a list of neighborhoods> user clicks on a neighborhood and is taken to that neighborhood page which will then have sub-navigation menu items to explore the contents of that neighborhood including places within that neighborhood)

2) - How to structure this so that an admin user could navigate to a specific page and update it's content in several block widgets on each page without the standard WYSIWYG editor that is so common for blog posts (and easy for that use but won't cut it alone in this case)

I'm approaching each Neighborhood page as a custom post type so therefore i'm creating a template that will be re-usable for every Neighborhood (there are 27 neighborhoods) so naturally the admin user would need to be able to update things like the neighborhood name, background color, main image of neighborhood, content in all widgets (some are just link lists others will import RSS feed titles), and insert images for a jquery slider. Here's a Neighborhood page example

Every neighborhood will also drill down to have a sub-navigation (all sub navs will be identical for each neighborhood but naturally need to have it's own unique content in each widget area and editable elements that i mentioned in the paragraph above)
notice the sub navigation links on the "Georgetown" page

So part of my question is:

Do all these pages need to just be static pages with custom post and field types so that they can be edited from the admin panel?

Since they are not posts i can't think of what else they would be.

And since they are all so repetitive in layout the only exception being content, how should i think about structuring the pages.

I don't mind manually linking all the pages together is that will make it easier since i can't wrap my head around how the client would create a new page and apply it to the correct neighborhood's place?

e.g (home>neighborhood>place>content on "Places" page)

And obviously this will equate to many pages since there are 27 neighborhoods and each neighborhood has a sub-nav with 4 menu items leading to Places, Gallery, History, and Points of Interest. All these sub-nav pages will have different content although laid out exactly the same for every neighborhood. That number of static pages could range from 108+ pages that will need content updated.

Needless to say that if these repetitive pages are made each into their own template then making new pages with a specific theme for each page could accomplish this but the question would be how does the client create these pages on their own and allow them to be able to edit the CONTENT ONLY (that should be controlled in its placement by the CSS) and make it systematic for the client to do so.

Otherwise i see myself having to create all the Neighborhood pages, all the Places pages within those neighborhoods and all the other neighborhood and place specific versions of the gallery, history, points of interest and then just have the client go in and alter the text and images for those pages but as you can imagine that will increase the time that i have to spend on the project and it becomes a matter of several more hours to do that when i imagine that once i create the template for each page (neighborhood, gallery, places, history, points of interest) the client could then create those pages and link them to each other.

I'll figure out how to link pages together in Wordpress since in know that the blog does that automatically with posts based on their timestamps, but how to link pages together to exact pages is another thing i haven't attempted yet in wordpress.

So there are some totally noob questions in here that i'll learn once i get hands on i just need a game plan with the correct terminology of how i'm going to put this site together and anyones input is greatly welcome.

Finally if there are new things in the latest version of WP that could aide in this build i would be grateful to learn about them, please share:)

Thank you.

impolex on "Youtube video output in comments through custom upload plugin"

$
0
0

I'm developing a pluggin for a client that will allow users to upload videos to easily upload videos and display videos for comments. Through the Youtube API users will fill out the video information and upload the video within my clients site in the comment section for the post. The pluggin will simultaneously upload the video to a community Youtube account and display the video in the comment.

The Youtube video is stored in the WordPress site as a url in the comment meta for the comment.

I have successful created the system for uploading Youtube and for storing the resulting URL.

My issue rests in attempting to display the video. I have found that WordPress does not want to do this. I have attempted four different techniques to achieve my result and none work.

Attempt 1: Processed Short Code

add_filter( 'comment_text', 'modify_comment');
    function modify_comment( $text ){

        if( $youtube = get_comment_meta( get_comment_ID(), 'youtube', true ) ) {
            $youtube = '[video src="http://www.youtube.com/watch?v='.$youtube.'" ]';
            $text = do_shortcode($youtube) . '<p>' . $text . '</p>';
        }
        return $text;
    }

Output: Clickable URL

Attempt 2: Plain Shortcode

add_filter( 'comment_text', 'modify_comment');
    function modify_comment( $text ){

        if( $youtube = get_comment_meta( get_comment_ID(), 'youtube', true ) ) {
            $youtube = '[video src="http://www.youtube.com/watch?v='.$youtube.'" ]';
            $text = $youtube . '<p>' . $text . '</p>';
        }
        return $text;
    }

Output: Shows shortcode as plain text

Attempt 3: Constructed iFrame

add_filter( 'comment_text', 'modify_comment');
    function modify_comment( $text ){

        if( $youtube = get_comment_meta( get_comment_ID(), 'youtube', true ) ) {
            $youtube = '<div><iframe title="YouTube video player" class="youtube-player" type="text/html" width="640"
height="390" src="http://www.youtube.com/watch?v='.$youtube.'" frameborder="0"
allowFullScreen></iframe></div>';
            $text = $youtube . $text;
        }
        return $text;
    }

output: Empty white box (broken iFrame)

Attempt 4: Just the URL

add_filter( 'comment_text', 'modify_comment');
    function modify_comment( $text ){

        if( $youtube = get_comment_meta( get_comment_ID(), 'youtube', true ) ) {
            $youtube = 'http://www.youtube.com/watch?v='.$youtube.';
            $text = $youtube . '<p>' . $text . '</p>';
        }
        return $text;
    }

Output: Plain Text URL (kind of expected that)

Has anyone else attempted this before? Can you think of any other ways to do this?


Myslovo on "Need to add a couple of words before Tag name in a custom plugin"

$
0
0

Hi there,

hope this is right place to post my question.. So I run Wordpress site as a dictionary, you can check a single entry here: http://myslovo.com/?dictionary=%D0%B0%D0%B1%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE . I want to add just two words of a plain text "Added by" (in Ukrainian) before that "Robert". I surfed all the files of both theme and plugin (and tried to edit some of them), but can not understand where is it.. I assume this is plugin thing, coz I've changed three themes, and that "Robert" always appears at the same place..

please give me any advice or link where I can read about this.. I'm asking here coz the developer from whom I bought plugin and theme doesn't reply to my messages.. please contact me if you have any questions..

Best,

Alex

kpatil on "Exporting the word press site as XML via a REST , API call"

$
0
0

Under tools-> export site we can export the entire site to an XML.

I am trying to automate this process via some external call e.g REST or XML-RPC.

//Pseudo Code
// XML xmlResponse= wordpressAPI(parameter1,parameter2,parameter3);

Then use xmlResponse for further processing.
I saw few API that can give xml response for sectons like posts , comments but not the entire XML.

Does word press has that provision ?

stesvis on "Custom Post Type Available to Subscribers Admin Page???"

$
0
0

Hello,

I let my subscribers post on my site. When they post, they actually create a custom post type.

When they go to the admin page, how can I let them view/edit their posts?
So far even if I set public=true in "register_post_type" they still can see only their profile.

I don't want them as contributors, I just want to let them edit that specific custom post type. Any idea?

Thanks!

Wordletz on "Create temporary user with Subscriber role"

$
0
0

Hi, first some background (skip ahead if tl;dr). I'm working with CAS (a single sign-on protocol) and Wordpress. The sign-ons work but only when I create a user in wordpress with the same login_name as their username in CAS. This works great for admin accounts and people I want to have greater access, but I would like to take advantage of the authentication CAS is already doing for the non-privileged users. This would be great for things like event signups, I won't have to validate emails and create users because the users in the CAS have full names and emails already associated with it that are authenticated much more rigorously than I can expect users to want to go through just to sign up for an event.

So wpcas provides a method to provision users, I could create a user for each one, but my site isn't nearly as strict with security as the host for the CAS is. Having a list of every user/email that's ever visited my site sitting there waiting to be taken would be a problem. So what I want to do is create a temporary user with the Subscriber role. Is there a way to do this without adding them to the database? something like
set_current_user(new WP_User($user, $user@site.com)) ?

suesques on "Evil Plug in- HELP ME"

Viewing all 8245 articles
Browse latest View live




Latest Images